- Timestamp:
- 09/10/13 21:11:41 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main/src/main/java/com/framsticks/params/ParamCandidate.java
r102 r105 79 79 protected final OneTime<Method> adder = new OneTime<>("adder"); 80 80 protected final OneTime<Method> remover = new OneTime<>("remover"); 81 protected final OneTime<Class<? extends Param>> paramType = new OneTime<>("paramType"); 82 81 83 protected int flags = 0; 82 84 … … 262 264 } 263 265 266 // public static <T extends Param> boolean isParamAnnorationOfTypeOrUnspecified(ParamAnnotation paramAnnotation, Class<T> paramType) { 267 // return paramAnnotation.paramType().equals(Param.class) || paramAnnotation.paramType().equals(paramType); 268 // } 269 270 // public static <T extends Param> boolean isParamAnnorationOfType(ParamAnnotation paramAnnotation, Class<T> paramType) { 271 // return paramAnnotation.paramType().equals(paramType); 272 // } 273 264 274 void add(ParamAnnotation paramAnnotation, Member member, String name) { 265 275 this.name.set(name); 266 276 annotations.add(paramAnnotation); 267 277 flags |= paramAnnotation.flags(); 278 if (!paramAnnotation.paramType().equals(Param.class)) { 279 paramType.set(paramAnnotation.paramType()); 280 } 268 281 if (member instanceof Field) { 269 282 field.set((Field) member); … … 273 286 if (member instanceof Method) { 274 287 Method m = (Method) member; 275 if (!paramAnnotation.paramType().equals(Param.class)) { 276 if (paramAnnotation.paramType().equals(ProcedureParam.class)) { 277 caller.set(m); 278 return; 279 } 280 throw new ConstructionException().msg("explicit set of paramType different than ProcedureParam is not yet supported").arg("name", name).arg("method", m).arg("in", this); 288 if (paramAnnotation.paramType().equals(ProcedureParam.class)) { 289 caller.set(m); 290 return; 281 291 } 282 292 Type[] ps = m.getGenericParameterTypes(); … … 392 402 protected static final Map<Class<?>, Set> setsCache = Collections.synchronizedMap(new IdentityHashMap<Class<?>, Set>()); 393 403 394 public static Set getAllCandidates( Class<?> javaClass) throws ConstructionException {404 public static Set getAllCandidates(final Class<?> javaClass) throws ConstructionException { 395 405 Set result = setsCache.get(javaClass); 396 406 if (result != null) { … … 399 409 400 410 List<Class<?>> javaClasses = new LinkedList<>(); 401 while (javaClass != null) { 402 javaClasses.add(0, javaClass); 403 javaClass = javaClass.getSuperclass(); 411 Class<?> jc = javaClass; 412 while (jc != null) { 413 javaClasses.add(0, jc); 414 jc = jc.getSuperclass(); 404 415 } 405 416 … … 473 484 // throw new ConstructionException().msg("void is not a valid type"); 474 485 // } 486 475 487 476 488 if (type instanceof ParameterizedType) { … … 562 574 } 563 575 564 565 576 public ParamBuilder induceParamType(ParamBuilder builder) { 566 577 Method method = getCaller(); 567 578 if (method == null) { 579 if (paramType.has()) { 580 return builder.type(paramType.get()); 581 } 568 582 return induceParamType(builder, getType()); 569 583 }
Note: See TracChangeset
for help on using the changeset viewer.