src/share/classes/sun/reflect/generics/reflectiveObjects/TypeVariableImpl.java

Print this page




 171             String thatName = that.getName();
 172 
 173             return
 174                 (genericDeclaration == null ?
 175                  thatDecl == null :
 176                  genericDeclaration.equals(thatDecl)) &&
 177                 (name == null ?
 178                  thatName == null :
 179                  name.equals(thatName));
 180 
 181         } else
 182             return false;
 183     }
 184 
 185     @Override
 186     public int hashCode() {
 187         return genericDeclaration.hashCode() ^ name.hashCode();
 188     }
 189 
 190     // Implementations of AnnotatedElement methods.
 191     public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) {
 192         Objects.requireNonNull(annotationClass);
 193         return false;
 194     }
 195 
 196     @SuppressWarnings("unchecked")
 197     public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
 198         Objects.requireNonNull(annotationClass);
 199         // T is an Annotation type, the return value of get will be an annotation
 200         return (T)mapAnnotations(getAnnotations()).get(annotationClass);
 201     }
 202 
 203     public <T extends Annotation> T getDeclaredAnnotation(Class<T> annotationClass) {
 204         Objects.requireNonNull(annotationClass);
 205         return getAnnotation(annotationClass);
 206     }
 207 
 208     public <T extends Annotation> T[] getAnnotations(Class<T> annotationClass) {
 209         Objects.requireNonNull(annotationClass);
 210         return AnnotationSupport.getMultipleAnnotations(mapAnnotations(getAnnotations()), annotationClass);
 211     }
 212 
 213     public <T extends Annotation> T[] getDeclaredAnnotations(Class<T> annotationClass) {
 214         Objects.requireNonNull(annotationClass);
 215         return getAnnotations(annotationClass);




 171             String thatName = that.getName();
 172 
 173             return
 174                 (genericDeclaration == null ?
 175                  thatDecl == null :
 176                  genericDeclaration.equals(thatDecl)) &&
 177                 (name == null ?
 178                  thatName == null :
 179                  name.equals(thatName));
 180 
 181         } else
 182             return false;
 183     }
 184 
 185     @Override
 186     public int hashCode() {
 187         return genericDeclaration.hashCode() ^ name.hashCode();
 188     }
 189 
 190     // Implementations of AnnotatedElement methods.





 191     @SuppressWarnings("unchecked")
 192     public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
 193         Objects.requireNonNull(annotationClass);
 194         // T is an Annotation type, the return value of get will be an annotation
 195         return (T)mapAnnotations(getAnnotations()).get(annotationClass);
 196     }
 197 
 198     public <T extends Annotation> T getDeclaredAnnotation(Class<T> annotationClass) {
 199         Objects.requireNonNull(annotationClass);
 200         return getAnnotation(annotationClass);
 201     }
 202 
 203     public <T extends Annotation> T[] getAnnotations(Class<T> annotationClass) {
 204         Objects.requireNonNull(annotationClass);
 205         return AnnotationSupport.getMultipleAnnotations(mapAnnotations(getAnnotations()), annotationClass);
 206     }
 207 
 208     public <T extends Annotation> T[] getDeclaredAnnotations(Class<T> annotationClass) {
 209         Objects.requireNonNull(annotationClass);
 210         return getAnnotations(annotationClass);