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