public TypeMirror[] getClassArrayValue(Annotation a, String name) { try { a.annotationType().getMethod(name).invoke(a); assert false; throw new IllegalStateException("should throw a MirroredTypesException"); } catch (IllegalAccessException e) { throw new IllegalAccessError(e.getMessage()); } catch (InvocationTargetException e) { if( e.getCause() instanceof MirroredTypesException ) { MirroredTypesException me = (MirroredTypesException)e.getCause(); Collection<TypeMirror> r = me.getTypeMirrors(); return r.toArray(new TypeMirror[r.size()]); } // impossible throw new RuntimeException(e); } catch (NoSuchMethodException e) { throw new NoSuchMethodError(e.getMessage()); } }
public TypeMirror[] getClassArrayValue(Annotation a, String name) { try { a.annotationType().getMethod(name).invoke(a); assert false; throw new IllegalStateException("should throw a MirroredTypesException"); } catch (IllegalAccessException e) { throw new IllegalAccessError(e.getMessage()); } catch (InvocationTargetException e) { if( e.getCause() instanceof MirroredTypesException ) { MirroredTypesException me = (MirroredTypesException)e.getCause(); Collection<TypeMirror> r = me.getTypeMirrors(); return r.toArray(new TypeMirror[r.size()]); } // impossible throw new RuntimeException(e); } catch (NoSuchMethodException e) { throw new NoSuchMethodError(e.getMessage()); } }
/** * @return The list of class names that this type definition wants you to "see also". */ public Collection<TypeMirror> getSeeAlsos() { Collection<TypeMirror> seeAlsos = null; XmlSeeAlso seeAlsoInfo = getAnnotation(XmlSeeAlso.class); if (seeAlsoInfo != null) { seeAlsos = new ArrayList<TypeMirror>(); try { AnnotationProcessorEnvironment env = Context.getCurrentEnvironment(); for (Class clazz : seeAlsoInfo.value()) { TypeDeclaration typeDeclaration = env.getTypeDeclaration(clazz.getName()); DeclaredType undecorated = env.getTypeUtils().getDeclaredType(typeDeclaration); seeAlsos.add(undecorated); } } catch (MirroredTypesException e) { seeAlsos.addAll(e.getTypeMirrors()); } } return seeAlsos; }
/** * @return The list of class names that this type definition wants you to "see also". */ public Collection<TypeMirror> getSeeAlsos() { Collection<TypeMirror> seeAlsos = null; XmlSeeAlso seeAlsoInfo = getAnnotation(XmlSeeAlso.class); if (seeAlsoInfo != null) { seeAlsos = new ArrayList<TypeMirror>(); try { AnnotationProcessorEnvironment env = Context.getCurrentEnvironment(); for (Class clazz : seeAlsoInfo.value()) { TypeDeclaration typeDeclaration = env.getTypeDeclaration(clazz.getName()); DeclaredType undecorated = env.getTypeUtils().getDeclaredType(typeDeclaration); seeAlsos.add(undecorated); } } catch (MirroredTypesException e) { seeAlsos.addAll(e.getTypeMirrors()); } } return seeAlsos; }
Collection<TypeMirror> mirrors = e.getTypeMirrors(); for (TypeMirror mirror : mirrors) { if (mirror instanceof ClassType) {
Collection<TypeMirror> mirrors = e.getTypeMirrors(); for (TypeMirror mirror : mirrors) { if (mirror instanceof ClassType) {