- Timestamp:
- 07/04/13 20:29:50 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main/src/main/java/com/framsticks/communication/queries/SetRequest.java
r84 r96 1 1 package com.framsticks.communication.queries; 2 3 import com.framsticks.util.lang.Pair; 2 4 3 5 /** … … 5 7 */ 6 8 public class SetRequest extends ApplicationRequest { 9 10 protected String field; 7 11 protected String value; 8 12 9 13 public SetRequest() { 14 } 15 16 public SetRequest field(String field) { 17 this.field = field; 18 return this; 10 19 } 11 20 … … 17 26 @Override 18 27 protected StringBuilder construct(StringBuilder buffer) { 19 super.construct(buffer); 20 if (value != null) { 21 buffer.append(" \"").append(value).append("\""); 22 } 23 return buffer; 28 return quoteArgumentIfNeeded(super.construct(buffer).append(' ').append(field).append(' '), value); 24 29 } 30 25 31 @Override 26 32 public String getCommand() { 27 33 return "set"; 28 34 } 35 36 37 @Override 38 public CharSequence parseRest(CharSequence rest) { 39 final Pair<CharSequence, CharSequence> fp = takeString(super.parseRest(rest)); 40 field = fp.first.toString(); 41 final Pair<CharSequence, CharSequence> vp = takeString(fp.second); 42 value = vp.first.toString(); 43 44 return vp.second; 45 } 46 47 /** 48 * @return the field 49 */ 50 public String getField() { 51 return field; 52 } 53 54 /** 55 * @return the value 56 */ 57 public String getValue() { 58 return value; 59 } 29 60 }
Note: See TracChangeset
for help on using the changeset viewer.