com.sun.xml.bind.v2.model.annotation
Interface AnnotationSource

All Known Subinterfaces:
AttributePropertyInfo<T,C>, ElementPropertyInfo<T,C>, MapPropertyInfo<T,C>, PropertyInfo<T,C>, PropertySeed<T,C,F,M>, ReferencePropertyInfo<T,C>, RuntimeAttributePropertyInfo, RuntimeElementPropertyInfo, RuntimeMapPropertyInfo, RuntimePropertyInfo, RuntimeReferencePropertyInfo, RuntimeValuePropertyInfo, ValuePropertyInfo<T,C>
All Known Implementing Classes:
AttributePropertyInfoImpl, CAttributePropertyInfo, CElementPropertyInfo, CPropertyInfo, CReferencePropertyInfo, CSingleTypePropertyInfo, CValuePropertyInfo, ElementInfoImpl.PropertyImpl, ElementPropertyInfoImpl, ERPropertyInfoImpl, FieldPropertySeed, GetterSetterPropertySeed, MapPropertyInfoImpl, PropertyInfoImpl, ReferencePropertyInfoImpl, RuntimeAttributePropertyInfoImpl, RuntimeClassInfoImpl.RuntimePropertySeed, RuntimeElementInfoImpl.RuntimePropertyImpl, RuntimeElementPropertyInfoImpl, RuntimeMapPropertyInfoImpl, RuntimeReferencePropertyInfoImpl, RuntimeValuePropertyInfoImpl, SingleTypePropertyInfoImpl, ValuePropertyInfoImpl

public interface AnnotationSource

Implemented by objects that can have annotations.


Method Summary
 boolean hasAnnotation(Class<? extends Annotation> annotationType)
          Returns true if the property has the specified annotation.
<A extends Annotation>
A
readAnnotation(Class<A> annotationType)
          Gets the value of the specified annotation from the given property.
 

Method Detail

readAnnotation

<A extends Annotation> A readAnnotation(Class<A> annotationType)
Gets the value of the specified annotation from the given property.

When this method is used for a property that consists of a getter and setter, it returns the annotation on either of those methods. If both methods have the same annotation, it is an error.

Returns:
null if the annotation is not present.

hasAnnotation

boolean hasAnnotation(Class<? extends Annotation> annotationType)
Returns true if the property has the specified annotation.

Short for readAnnotation(annotationType)!=null, but this method is typically faster.