Changeset 84 for java/main/src/main/java/com/framsticks/communication/queries/ApplicationRequest.java
- Timestamp:
- 06/22/13 21:51:33 (11 years ago)
- Location:
- java/main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main
-
Property
svn:ignore
set to
target
-
Property
svn:ignore
set to
-
java/main/src/main/java/com/framsticks/communication/queries/ApplicationRequest.java
r77 r84 2 2 3 3 import com.framsticks.communication.Request; 4 import com.framsticks.util.lang.Delimeted; 4 5 5 6 import java.util.Collection; … … 10 11 public abstract class ApplicationRequest extends Request { 11 12 12 13 13 protected String path; 14 protected String fields; 14 15 15 16 17 18 19 16 public ApplicationRequest setPath(String path) { 17 assert path != null; 18 this.path = path; 19 return this; 20 } 20 21 21 22 23 24 22 public ApplicationRequest setField(String field) { 23 this.fields = field; 24 return this; 25 } 25 26 26 public ApplicationRequest setFields(Collection<String> fields) { 27 StringBuilder fieldString = new StringBuilder(); 28 boolean notFirst = false; 29 for (String field : fields) { 30 if (notFirst) { 31 fieldString.append(","); 32 33 } else { 34 notFirst = true; 35 } 36 fieldString.append(field); 37 } 38 return setField(fieldString.toString()); 39 } 27 public ApplicationRequest setFields(Collection<String> fields) { 28 Delimeted d = new Delimeted(",", ""); 29 for (String f : fields) { 30 d.append(f); 31 } 32 return setField(d.build()); 33 } 40 34 41 35 42 43 44 36 public String getPath() { 37 return path; 38 } 45 39 46 47 48 49 50 51 52 53 40 @Override 41 protected StringBuilder construct(StringBuilder buffer) { 42 buffer.append(' ').append(path); 43 if (fields != null) { 44 buffer.append(' ').append(fields); 45 } 46 return buffer; 47 } 54 48 55 56 57 58 49 @Override 50 public void parseRest(String rest) { 51 path = rest; 52 } 59 53 60 54 }
Note: See TracChangeset
for help on using the changeset viewer.