- Timestamp:
- 07/04/13 20:29:50 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main/src/main/java/com/framsticks/params/ParamBuilder.java
r90 r96 6 6 import com.framsticks.util.Builder; 7 7 import com.framsticks.util.FramsticksException; 8 import com.framsticks.util.Misc; 8 9 import com.framsticks.util.lang.Strings; 9 10 … … 46 47 47 48 /** The flags stored as a bit sum. */ 48 private Integerflags = 0;49 private int flags = 0; 49 50 50 51 /** The parameter name. */ … … 63 64 private Object def; 64 65 65 private Integer extra;66 private int extra = 0; 66 67 67 68 String containedTypeName; … … 179 180 try { 180 181 if (paramType == null) { 181 throw new FramsticksException().msg("trying to finish incomplete param ");182 throw new FramsticksException().msg("trying to finish incomplete param while type is missing"); 182 183 } 183 184 return paramType.getConstructor(ParamBuilder.class).newInstance(this); … … 214 215 215 216 @ParamAnnotation 216 public ParamBuilder flags( Integerflags) {217 public ParamBuilder flags(int flags) { 217 218 this.flags = flags; 218 219 return this; … … 359 360 */ 360 361 @ParamAnnotation 361 public IntegergetFlags() {362 public int getFlags() { 362 363 return flags; 363 364 } … … 385 386 386 387 @ParamAnnotation(id = "xtra") 387 public IntegergetExtra() {388 public int getExtra() { 388 389 return extra; 389 390 } … … 397 398 398 399 @ParamAnnotation(id = "xtra") 399 public ParamBuilder extra( Integerextra) {400 public ParamBuilder extra(int extra) { 400 401 this.extra = extra; 401 402 return this; … … 517 518 } 518 519 String result = Strings.collapse(matcher.group(1)); 519 resultType = (result != null) ? parseProcedureTypePart(result, null) : null; 520 if (result != null) { 521 resultType = Param.build().type(result).finish(ValueParam.class); 522 } else { 523 resultType = null; 524 } 520 525 String arguments = matcher.group(2); 521 526 if (!Strings.notEmpty(arguments)) { … … 524 529 int number = 0; 525 530 for (String a : arguments.split(",")) { 531 ParamBuilder arg = Param.build(); 532 526 533 int space = a.indexOf(' '); 527 String type;528 String name;529 534 if (space == -1) { 530 type = a; 531 name = "arg" + number; 535 arg.type(a).id("arg" + number); 532 536 } else { 533 type = a.substring(0, space);534 name = a.substring(space + 1);535 } 536 argumentsType.add( parseProcedureTypePart(type, name));537 String name = a.substring(space + 1); 538 arg.type(a.substring(0, space)).id(name).name(name); 539 } 540 argumentsType.add(arg.finish(ValueParam.class)); 537 541 ++number; 538 542 } … … 546 550 return this; 547 551 } 552 553 @Override 554 public String toString() { 555 return "ParamBuilder for " + Misc.returnNotNull(id, "<not yet known>"); 556 } 548 557 } 549 558
Note: See TracChangeset
for help on using the changeset viewer.