- Timestamp:
- 07/10/13 22:41:02 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main/src/main/java/com/framsticks/params/FramsClassBuilder.java
r98 r99 40 40 41 41 public static ParamBuilder induceParamType(ParamBuilder builder, Type type) { 42 // if (type.equals(Void.TYPE)) { 43 // throw new ConstructionException().msg("void is not a valid type"); 44 // } 42 45 43 46 if (type instanceof ParameterizedType) { … … 47 50 //TODO make implementation here 48 51 boolean map = false; 52 StringBuilder b = new StringBuilder(); 49 53 if (rawType.equals(Map.class)) { 50 54 containedType = p.getActualTypeArguments()[1]; 51 55 map = true; 56 b.append("l"); 52 57 } else if (rawType.equals(List.class)) { 53 58 containedType = p.getActualTypeArguments()[0]; 59 b.append("l"); 60 } else if (rawType.equals(EventListener.class)) { 61 containedType = p.getActualTypeArguments()[0]; 62 b.append("e"); 54 63 } 55 64 if (!(containedType instanceof Class)) { 56 65 return builder; 57 66 } 67 b.append(" "); 68 58 69 Class<?> containedClass = (Class<?>) containedType; 59 StringBuilder b = new StringBuilder();60 b.append("l ");61 70 FramsClassAnnotation fca = containedClass.getAnnotation(FramsClassAnnotation.class); 62 71 if (fca == null) { 63 log.error("the class is not annotated: " + containedClass); 64 return builder; 72 throw new ConstructionException().msg("the contained class is not annotated").arg("class", containedClass); 65 73 } 66 74 b.append(getName(fca, containedClass)); 75 //TODO parametrize this 67 76 if (map) { 68 77 b.append(" name"); … … 109 118 return builder; 110 119 } 120 111 121 112 122 // builder.type("o " + (cl).getCanonicalName()); … … 174 184 } 175 185 if (argsNum == 1) { 176 return n.startsWith("set") ? Strings.uncapitalize(n.substring(3)) : n; 186 if (n.startsWith("set")) { 187 return Strings.uncapitalize(n.substring(3)); 188 } 189 if (n.startsWith("add")) { 190 return Strings.uncapitalize(n.substring(3)); 191 } 192 if (n.startsWith("remove")) { 193 return Strings.uncapitalize(n.substring(6)); 194 } 195 return n; 177 196 } 178 197 log.error("invalid number of arguments");
Note: See TracChangeset
for help on using the changeset viewer.