|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.openjpa.persistence.meta.SourceAnnotationHandler
public class SourceAnnotationHandler
Extracts persistent metadata information by analyzing available annotation in *.java source files. Requires JDK6 Annotation Processing environment available.
Field Summary | |
---|---|
protected org.apache.openjpa.persistence.meta.SourceAnnotationHandler.AnnotatedFilter |
annotatedFilter
|
protected org.apache.openjpa.persistence.meta.SourceAnnotationHandler.AccessFilter |
fieldAccessFilter
|
protected org.apache.openjpa.persistence.meta.SourceAnnotationHandler.KindFilter |
fieldFilter
|
protected org.apache.openjpa.persistence.meta.SourceAnnotationHandler.GetterFilter |
getterFilter
|
protected static List<Class<? extends Annotation>> |
mappingAnnos
|
protected org.apache.openjpa.persistence.meta.SourceAnnotationHandler.KindFilter |
methodFilter
|
protected org.apache.openjpa.persistence.meta.SourceAnnotationHandler.TransientFilter |
nonTransientFilter
|
protected org.apache.openjpa.persistence.meta.SourceAnnotationHandler.AccessFilter |
propertyAccessFilter
Set of Inclusion Filters based on member type, access type or transient annotations. |
protected org.apache.openjpa.persistence.meta.SourceAnnotationHandler.SetterFilter |
setterFilter
|
Constructor Summary | |
---|---|
SourceAnnotationHandler(ProcessingEnvironment processingEnv,
CompileTimeLogger logger)
Construct with JDK6 annotation processing environment. |
Method Summary | |
---|---|
TypeMirror |
box(TypeMirror t)
|
int |
determineMemberAccess(Element m)
Determine the access type of the given member. |
int |
determineTypeAccess(TypeElement type)
Determine the access type of the given type. |
static boolean |
equalsByValue(Enum<?> e,
Object v)
Affirms if the given enum equals the given value. |
String |
extractFieldName(ExecutableElement method)
|
static Object |
getAnnotationValue(Element decl,
Class<? extends Annotation> anno)
Gets the value of the given annotation, if present, in the given declaration. |
static Object |
getAnnotationValue(Element e,
Class<? extends Annotation> anno,
String attr)
Gets the value of the given attribute of the given annotation, if present, in the given declaration. |
Set<Element> |
getPersistentMembers(TypeElement type)
Gets the list of persistent fields and/or methods for the given type. |
TypeElement |
getPersistentSupertype(TypeElement cls)
|
static boolean |
isAnnotated(Element e)
Affirms if the given element is annotated with any javax.persistence. |
static boolean |
isAnnotatedWith(Element e,
Class<? extends Annotation> anno)
Affirms if the given declaration has the given annotation. |
static boolean |
isAnnotatedWith(Element e,
Set<String> annos)
Affirms if the given element is annotated with any of the given annotations. |
static boolean |
isBoolean(TypeMirror type)
Affirms if the given mirror represents a primitive or non-primitive boolean. |
static boolean |
isBooleanGetter(ExecutableElement method)
Affirms if the given method matches the following signature public boolean isXyz()
public Boolean isXyz() |
static boolean |
isGetter(ExecutableElement method)
|
static boolean |
isMethod(Element e)
Affirms if the given element represents a method. |
boolean |
isMixedAccess(TypeElement t)
Affirms if the members of given type are using both field and property based access. |
static boolean |
isNormalGetter(ExecutableElement method)
Affirms if the given method matches the following signature public T getXXX()
where T is any non-void type. |
static boolean |
isRootObject(TypeMirror type)
Affirms if the given mirror represents root java.lang.Object. |
static boolean |
isSetter(ExecutableElement method)
Affirms if the given method matches the following signature public void setXXX(T t) |
static boolean |
isVoid(TypeMirror type)
Affirms if the given mirror represents a void. |
static boolean |
startsWith(String full,
String head)
Affirms if the given full string starts with the given head. |
static String |
toString(Collection<? extends Element> elements)
|
List<Exception> |
validateAccess(TypeElement t)
Gets the violations, if any. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected org.apache.openjpa.persistence.meta.SourceAnnotationHandler.AccessFilter propertyAccessFilter
protected org.apache.openjpa.persistence.meta.SourceAnnotationHandler.AccessFilter fieldAccessFilter
protected org.apache.openjpa.persistence.meta.SourceAnnotationHandler.KindFilter fieldFilter
protected org.apache.openjpa.persistence.meta.SourceAnnotationHandler.KindFilter methodFilter
protected org.apache.openjpa.persistence.meta.SourceAnnotationHandler.TransientFilter nonTransientFilter
protected org.apache.openjpa.persistence.meta.SourceAnnotationHandler.AnnotatedFilter annotatedFilter
protected org.apache.openjpa.persistence.meta.SourceAnnotationHandler.GetterFilter getterFilter
protected org.apache.openjpa.persistence.meta.SourceAnnotationHandler.SetterFilter setterFilter
protected static List<Class<? extends Annotation>> mappingAnnos
Constructor Detail |
---|
public SourceAnnotationHandler(ProcessingEnvironment processingEnv, CompileTimeLogger logger)
Method Detail |
---|
public int determineTypeAccess(TypeElement type)
MetadataProcessor
determineTypeAccess
in interface MetadataProcessor<TypeElement,Element>
public int determineMemberAccess(Element m)
MetadataProcessor
determineMemberAccess
in interface MetadataProcessor<TypeElement,Element>
public List<Exception> validateAccess(TypeElement t)
MetadataProcessor
validateAccess
in interface MetadataProcessor<TypeElement,Element>
public boolean isMixedAccess(TypeElement t)
MetadataProcessor
isMixedAccess
in interface MetadataProcessor<TypeElement,Element>
public Set<Element> getPersistentMembers(TypeElement type)
getPersistentMembers
in interface MetadataProcessor<TypeElement,Element>
public static Object getAnnotationValue(Element decl, Class<? extends Annotation> anno)
public static Object getAnnotationValue(Element e, Class<? extends Annotation> anno, String attr)
public static String toString(Collection<? extends Element> elements)
public String extractFieldName(ExecutableElement method)
public static boolean isAnnotated(Element e)
javax.persistence.*
or org.apache.openjpa.*
annotation.
public static boolean isAnnotatedWith(Element e, Class<? extends Annotation> anno)
public static boolean isAnnotatedWith(Element e, Set<String> annos)
annos
- null checks for any annotation that starts with
'javax.persistence.' or 'openjpa.*'.public TypeMirror box(TypeMirror t)
public TypeElement getPersistentSupertype(TypeElement cls)
getPersistentSupertype
in interface MetadataProcessor<TypeElement,Element>
public static boolean isBoolean(TypeMirror type)
public static boolean isVoid(TypeMirror type)
public static boolean isMethod(Element e)
public static boolean isNormalGetter(ExecutableElement method)
public T getXXX()
where T is any non-void type.
public static boolean isBooleanGetter(ExecutableElement method)
public boolean isXyz()
public Boolean isXyz()
public static boolean isGetter(ExecutableElement method)
public static boolean isSetter(ExecutableElement method)
public void setXXX(T t)
public static boolean isRootObject(TypeMirror type)
public static boolean startsWith(String full, String head)
public static boolean equalsByValue(Enum<?> e, Object v)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |