001package com.box.sdk; 002 003/** 004 * Class is used to be a range for two byte numbers. Ususally paired with varying search filters. 005 * 006 */ 007public class SizeRange { 008 private int lowerBoundBytes; 009 private int upperBoundBytes; 010 011 /** 012 * Used for specify a file size range to filter to be used in search. 013 * @param lowerBoundBytes is the lower size in the byte range. 014 * @param upperBoundBytes is the upper limit in the byte range. 015 */ 016 public SizeRange(int lowerBoundBytes, int upperBoundBytes) { 017 this.lowerBoundBytes = lowerBoundBytes; 018 this.upperBoundBytes = upperBoundBytes; 019 } 020 /** 021 * Return the lower size in the byte range. 022 * @return int that represents the lower size of a file. 023 */ 024 public int getLowerBoundBytes() { 025 return this.lowerBoundBytes; 026 } 027 /** 028 * Set the lower bound bytes in the byte file size range. 029 * @param lowerBoundBytes used for the lower file size range. 030 */ 031 public void setLowerBoundBytes(int lowerBoundBytes) { 032 this.lowerBoundBytes = lowerBoundBytes; 033 } 034 /** 035 * Get the upper bound bytes in the file size range. 036 * @return int that represents the upper limit of the file size. 037 */ 038 public int getUpperBoundBytes() { 039 return this.upperBoundBytes; 040 } 041 /** 042 * Set the upper bound bytes in the file size range. 043 * @param upperBoundBytes used for the upper file size range. 044 */ 045 public void setUpperBoundBytes(int upperBoundBytes) { 046 this.upperBoundBytes = upperBoundBytes; 047 } 048 /** 049 * Used to build out a string a http box api friendly range string. 050 * @return String that is uses as a rest parameter. 051 */ 052 public String buildRangeString() { 053 String lowerBoundString = ""; 054 if (this.lowerBoundBytes > -1) { 055 lowerBoundString = String.valueOf(this.lowerBoundBytes); 056 } 057 058 String upperBoundString = ""; 059 if (this.upperBoundBytes > -1) { 060 upperBoundString = String.valueOf(this.upperBoundBytes); 061 } 062 String rangeString = String.format("%s,%s", lowerBoundString, upperBoundString); 063 if (rangeString == ",") { 064 rangeString = null; 065 } 066 return rangeString; 067 } 068}