@Override public String toString() { return this.annotation.toString(); } }
@Override public boolean equals(Object other) { if (this == other) { return true; } AnnotationConverterKey otherKey = (AnnotationConverterKey) other; return (this.fieldType == otherKey.fieldType && this.annotation.equals(otherKey.annotation)); }
public Class<? extends Annotation> getAnnotationType() { return this.annotation.annotationType(); }
/** * Outer class that exists solely to let us write {@code Partially.GwtIncompatible} instead of plain * {@code GwtIncompatible}. This is more accurate for {@link Futures#catching}, which is available * under GWT but with a slightly different signature. * * <p>We can't use {@code PartiallyGwtIncompatible} because then the GWT compiler wouldn't recognize * it as a {@code GwtIncompatible} annotation. And for {@code Futures.catching}, we need the GWT * compiler to autostrip the normal server method in order to expose the special, inherited GWT * version. */ @GwtCompatible final class Partially { /** * The presence of this annotation on an API indicates that the method <i>may</i> be used with the * <a href="http://www.gwtproject.org/">Google Web Toolkit</a> (GWT) but that it has <i>some * restrictions</i>. */ @Retention(RetentionPolicy.CLASS) @Target({ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD}) @Documented @interface GwtIncompatible { String value(); } private Partially() {} }
@Override public int hashCode() { return (this.fieldType.hashCode() * 29 + this.annotation.hashCode()); } }
/** * {@inheritDoc} */ public Void resolve() { throw new IncompleteAnnotationException(annotationType, property); }
public Class<? extends java.lang.annotation.Annotation> getAnnotationType () { return annotation.annotationType(); } }
@Component class WithNestedAnnotation { @Retention(RetentionPolicy.RUNTIME) @Component public static @interface MyComponent { } }
private boolean annotationEquals(Annotation ann, Annotation otherAnn) { // Annotation.equals is reflective and pretty slow, so let's check identity and proxy type first. return (ann == otherAnn || (ann.getClass() == otherAnn.getClass() && ann.equals(otherAnn))); }
public Class<? extends java.lang.annotation.Annotation> getAnnotationType () { return annotation.annotationType(); } }
public Class<? extends java.lang.annotation.Annotation> getAnnotationType () { return annotation.annotationType(); } }
public Class<? extends java.lang.annotation.Annotation> getAnnotationType () { return annotation.annotationType(); } }
@Override @SuppressWarnings("unchecked") @Nullable public <T extends Annotation> T getAnnotation(Class<T> annotationClass) { for (Annotation ann : annotations) { if (ann.annotationType() == annotationClass) { return (T) ann; } } return null; } @Override
/** * Construct a new {@code DefaultAnnotationAttributeExtractor}. * @param annotation the annotation to synthesize; never {@code null} * @param annotatedElement the element that is annotated with the supplied * annotation; may be {@code null} if unknown */ DefaultAnnotationAttributeExtractor(Annotation annotation, @Nullable Object annotatedElement) { super(annotation.annotationType(), annotatedElement, annotation); }
@Nullable public Class<? extends Annotation> getComposedAnnotationType() { return (this.composedAnnotation != null ? this.composedAnnotation.annotationType() : null); }
@Override public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) { for (Annotation annotation : getAnnotations()) { if (annotation.annotationType() == annotationClass) { return true; } } return false; }