Ejemplo n.º 1
0
 void init(Constructor constructor) {
   for (TypeVariable param : constructor.getTypeParameters()) {
     typeParameters.add(ElementFactory.getTypeParameterElement(param));
   }
   type = TypeMirrorFactory.get(constructor);
   enclosingElement = ElementFactory.get(constructor.getDeclaringClass());
   returnType = Typ.getNoType(TypeKind.VOID);
   Type[] genericParameterTypes = constructor.getGenericParameterTypes();
   Annotation[][] parameterAnnotations = constructor.getParameterAnnotations();
   int index = 0;
   for (Type param : genericParameterTypes) {
     parameters.add(ElementFactory.getVariableElement(param, parameterAnnotations[index++]));
   }
   varArgs = constructor.isVarArgs();
   for (Type type : constructor.getGenericExceptionTypes()) {
     thrownTypes.add(TypeMirrorFactory.get(type));
   }
 }
Ejemplo n.º 2
0
 void init(Method method) {
   for (TypeVariable param : method.getTypeParameters()) {
     typeParameters.add(ElementFactory.getTypeParameterElement(param));
   }
   type = TypeMirrorFactory.get(method);
   enclosingElement = ElementFactory.get(method.getDeclaringClass());
   returnType = TypeMirrorFactory.get(method.getGenericReturnType());
   Type[] genericParameterTypes = method.getGenericParameterTypes();
   Annotation[][] parameterAnnotations = method.getParameterAnnotations();
   int index = 0;
   for (Type param : genericParameterTypes) {
     parameters.add(ElementFactory.getVariableElement(param, parameterAnnotations[index++]));
   }
   varArgs = method.isVarArgs();
   for (Type type : method.getGenericExceptionTypes()) {
     thrownTypes.add(TypeMirrorFactory.get(type));
   }
   Object defValue = method.getDefaultValue();
   if (defValue != null) {
     defaultValue = new AnnotationValueImpl(defValue);
   }
 }