public SingleValueResultReturnThing(ResolvedMethod method) { if (method.getRawMember().isAnnotationPresent(SingleValueResult.class)) { SingleValueResult svr = method.getRawMember().getAnnotation(SingleValueResult.class); // try to guess generic type if(SingleValueResult.Default.class == svr.value()){ TypeBindings typeBindings = method.getReturnType().getTypeBindings(); if(typeBindings.size() == 1){ this.returnType = typeBindings.getBoundType(0).getErasedType(); }else{ throw new IllegalArgumentException("Ambiguous generic information. SingleValueResult type could not be fetched."); } }else{ this.returnType = svr.value(); } this.containerType = method.getReturnType().getErasedType(); } else { this.returnType = method.getReturnType().getErasedType(); this.containerType = null; } }
public SingleValueResultReturnThing(ResolvedMethod method) { if (method.getRawMember().isAnnotationPresent(SingleValueResult.class)) { SingleValueResult svr = method.getRawMember().getAnnotation(SingleValueResult.class); // try to guess generic type if(SingleValueResult.Default.class == svr.value()){ TypeBindings typeBindings = method.getReturnType().getTypeBindings(); if(typeBindings.size() == 1){ this.returnType = typeBindings.getBoundType(0).getErasedType(); }else{ throw new IllegalArgumentException("Ambiguous generic information. SingleValueResult type could not be fetched."); } }else{ this.returnType = svr.value(); } this.containerType = method.getReturnType().getErasedType(); } else { this.returnType = method.getReturnType().getErasedType(); this.containerType = null; } }