public class AnnotationProcessorUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
AnnotationProcessorUtils.TypeCategory |
Constructor and Description |
---|
AnnotationProcessorUtils() |
Modifier and Type | Method and Description |
---|---|
static javax.lang.model.type.TypeMirror |
getDeclaredType(javax.lang.model.element.Element elem)
Accessor for the declared type of this element.
|
static String |
getDeclaredTypeName(javax.annotation.processing.ProcessingEnvironment processingEnv,
javax.lang.model.type.TypeMirror type,
boolean box)
Method to return the declared type name of the provided TypeMirror.
|
static List<? extends javax.lang.model.element.Element> |
getFieldMembers(javax.lang.model.element.TypeElement el)
Convenience accessor for all field members of the supplied type element.
|
static String |
getMemberName(javax.lang.model.element.Element el)
Accessor for the member name for a field or Java bean getter/setter.
|
static List<? extends javax.lang.model.element.Element> |
getPropertyMembers(javax.lang.model.element.TypeElement el)
Convenience accessor for all property members of the supplied type element.
|
static AnnotationProcessorUtils.TypeCategory |
getTypeCategoryForTypeMirror(String typeName)
Method to return the JPA2 type category for a type.
|
static Object |
getValueForAnnotationAttribute(javax.lang.model.element.Element elem,
Class annotCls,
String attribute)
Accessor for the value for an annotation attribute.
|
static boolean |
isJavaBeanGetter(javax.lang.model.element.ExecutableElement method)
Convenience method to return if the provided method is a java bean getter.
|
static boolean |
isJavaBeanSetter(javax.lang.model.element.ExecutableElement method)
Convenience method to return if the provided method is a java bean setter.
|
static boolean |
isMethod(javax.lang.model.element.Element elem)
Convenience method to return if the provided element represents a method (otherwise a field).
|
static boolean |
returnsBoolean(javax.lang.model.element.ExecutableElement method)
Convenience method returning if the provided method returns boolean.
|
static boolean |
returnsVoid(javax.lang.model.element.ExecutableElement method)
Convenience method returning if the provided method returns void.
|
static boolean |
typeIsPrimitive(javax.lang.model.type.TypeMirror type)
Convenience method to return if the provided type is a primitive.
|
public static AnnotationProcessorUtils.TypeCategory getTypeCategoryForTypeMirror(String typeName)
typeName
- The type name (e.g java.lang.String, java.util.Collection)public static List<? extends javax.lang.model.element.Element> getFieldMembers(javax.lang.model.element.TypeElement el)
el
- The type elementpublic static List<? extends javax.lang.model.element.Element> getPropertyMembers(javax.lang.model.element.TypeElement el)
el
- The type elementpublic static boolean isJavaBeanGetter(javax.lang.model.element.ExecutableElement method)
method
- The methodpublic static String getMemberName(javax.lang.model.element.Element el)
el
- The elementpublic static boolean isJavaBeanSetter(javax.lang.model.element.ExecutableElement method)
method
- The methodpublic static boolean isMethod(javax.lang.model.element.Element elem)
elem
- The elementpublic static javax.lang.model.type.TypeMirror getDeclaredType(javax.lang.model.element.Element elem)
elem
- The elementpublic static Object getValueForAnnotationAttribute(javax.lang.model.element.Element elem, Class annotCls, String attribute)
elem
- The elementannotCls
- Annotation classattribute
- The attribute we're interested inpublic static boolean returnsVoid(javax.lang.model.element.ExecutableElement method)
method
- The methodpublic static boolean returnsBoolean(javax.lang.model.element.ExecutableElement method)
method
- The methodpublic static boolean typeIsPrimitive(javax.lang.model.type.TypeMirror type)
type
- The typepublic static String getDeclaredTypeName(javax.annotation.processing.ProcessingEnvironment processingEnv, javax.lang.model.type.TypeMirror type, boolean box)
processingEnv
- Processing environmenttype
- The type (mirror)box
- Whether to (auto)box this typeCopyright © 2013. All rights reserved.