src/share/classes/sun/reflect/annotation/AnnotatedTypeFactory.java

Print this page




 121 
 122     private static class AnnotatedTypeBaseImpl implements AnnotatedType {
 123         private final Type type;
 124         private final AnnotatedElement decl;
 125         private final LocationInfo location;
 126         private final TypeAnnotation[] allOnSameTargetTypeAnnotations;
 127         private final Map<Class <? extends Annotation>, Annotation> annotations;
 128 
 129         AnnotatedTypeBaseImpl(Type type, LocationInfo location,
 130                 TypeAnnotation[] actualTypeAnnotations, TypeAnnotation[] allOnSameTargetTypeAnnotations,
 131                 AnnotatedElement decl) {
 132             this.type = type;
 133             this.decl = decl;
 134             this.location = location;
 135             this.allOnSameTargetTypeAnnotations = allOnSameTargetTypeAnnotations;
 136             this.annotations = TypeAnnotationParser.mapTypeAnnotations(location.filter(actualTypeAnnotations));
 137         }
 138 
 139         // AnnotatedElement
 140         @Override
 141         public final boolean isAnnotationPresent(Class<? extends Annotation> annotation) {
 142             return annotations.get(annotation) != null;
 143         }
 144 
 145         @Override
 146         public final Annotation[] getAnnotations() {
 147             return getDeclaredAnnotations();
 148         }
 149 
 150         @Override
 151         public final <T extends Annotation> T getAnnotation(Class<T> annotation) {
 152             return getDeclaredAnnotation(annotation);
 153         }
 154 
 155         @Override
 156         public final <T extends Annotation> T[] getAnnotations(Class<T> annotation) {
 157             return getDeclaredAnnotations(annotation);
 158         }
 159 
 160         @Override
 161         public Annotation[] getDeclaredAnnotations() {
 162             return annotations.values().toArray(new Annotation[0]);
 163         }
 164 
 165         @Override




 121 
 122     private static class AnnotatedTypeBaseImpl implements AnnotatedType {
 123         private final Type type;
 124         private final AnnotatedElement decl;
 125         private final LocationInfo location;
 126         private final TypeAnnotation[] allOnSameTargetTypeAnnotations;
 127         private final Map<Class <? extends Annotation>, Annotation> annotations;
 128 
 129         AnnotatedTypeBaseImpl(Type type, LocationInfo location,
 130                 TypeAnnotation[] actualTypeAnnotations, TypeAnnotation[] allOnSameTargetTypeAnnotations,
 131                 AnnotatedElement decl) {
 132             this.type = type;
 133             this.decl = decl;
 134             this.location = location;
 135             this.allOnSameTargetTypeAnnotations = allOnSameTargetTypeAnnotations;
 136             this.annotations = TypeAnnotationParser.mapTypeAnnotations(location.filter(actualTypeAnnotations));
 137         }
 138 
 139         // AnnotatedElement
 140         @Override





 141         public final Annotation[] getAnnotations() {
 142             return getDeclaredAnnotations();
 143         }
 144 
 145         @Override
 146         public final <T extends Annotation> T getAnnotation(Class<T> annotation) {
 147             return getDeclaredAnnotation(annotation);
 148         }
 149 
 150         @Override
 151         public final <T extends Annotation> T[] getAnnotations(Class<T> annotation) {
 152             return getDeclaredAnnotations(annotation);
 153         }
 154 
 155         @Override
 156         public Annotation[] getDeclaredAnnotations() {
 157             return annotations.values().toArray(new Annotation[0]);
 158         }
 159 
 160         @Override