org.androidannotations.helper
Class AnnotationHelper

java.lang.Object
  extended by org.androidannotations.helper.AnnotationHelper
Direct Known Subclasses:
TargetAnnotationHelper

public class AnnotationHelper
extends Object


Constructor Summary
AnnotationHelper(ProcessingEnvironment processingEnv)
           
 
Method Summary
 String actionName(String annotationName)
           
 boolean defaultResIdValue(int[] values)
           
 boolean defaultResName(String[] resNames)
           
 boolean enclosingElementHasEnhancedComponentAnnotation(Element element)
           
 List<DeclaredType> extractAnnotationClassArrayParameter(Element element, String annotationName, String methodName)
           
 DeclaredType extractAnnotationClassParameter(Element element, String annotationName)
           
 DeclaredType extractAnnotationClassParameter(Element element, String annotationName, String methodName)
           
 List<com.sun.codemodel.JFieldRef> extractAnnotationFieldRefs(ProcessHolder holder, Element element, String annotationName, IRInnerClass rInnerClass, boolean useElementName)
          Returns a list of JFieldRef linking to the R class, based on the given annotation
<T> T
extractAnnotationParameter(Element element, String annotationName, String methodName)
           
 int[] extractAnnotationResIdValueParameter(Element element, String annotationName)
           
 String[] extractAnnotationResNameParameter(Element element, String annotationName)
           
 List<String> extractAnnotationResources(Element element, String annotationName, IRInnerClass rInnerClass, boolean useElementName)
          Method to handle all annotations dealing with resource ids that can be set using the value() parameter of the annotation (as int or int[]), the resName() parameter of the annotation (as String or String[]), the element name.
 String extractElementName(Element element, String annotationName)
           
 AnnotationMirror findAnnotationMirror(Element annotatedElement, String annotationName)
           
 Elements getElementUtils()
           
 Types getTypeUtils()
           
 boolean hasOneOfClassAnnotations(Element element, Class<? extends Annotation> validAnnotation)
           
 boolean hasOneOfClassAnnotations(Element element, List<Class<? extends Annotation>> validAnnotations)
           
 boolean isAbstract(Element element)
           
 boolean isAnnotation(TypeElement annotation, String annotationName)
           
 boolean isFinal(Element element)
           
 boolean isInterface(TypeElement element)
           
 boolean isPrivate(Element element)
           
 boolean isPublic(Element element)
           
 boolean isSubtype(TypeElement t1, TypeElement t2)
           
 boolean isSubtype(TypeMirror potentialSubtype, TypeMirror potentialSupertype)
          Tests whether one type is a subtype of another.
 boolean isSynchronized(Element element)
           
 boolean isTopLevel(TypeElement element)
           
 void printAnnotationError(Element annotatedElement, String annotationName, String message)
           
 void printAnnotationMessage(Level level, Element annotatedElement, String annotationName, String message)
           
 void printAnnotationWarning(Element annotatedElement, String annotationName, String message)
           
 void printError(Element element, String message)
           
 TypeElement typeElementFromQualifiedName(String qualifiedName)
          This method may return null if the TypeElement cannot be found in the processor classpath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationHelper

public AnnotationHelper(ProcessingEnvironment processingEnv)
Method Detail

isSubtype

public boolean isSubtype(TypeMirror potentialSubtype,
                         TypeMirror potentialSupertype)
Tests whether one type is a subtype of another. Any type is considered to be a subtype of itself.


isSubtype

public boolean isSubtype(TypeElement t1,
                         TypeElement t2)

typeElementFromQualifiedName

public TypeElement typeElementFromQualifiedName(String qualifiedName)
This method may return null if the TypeElement cannot be found in the processor classpath


findAnnotationMirror

public AnnotationMirror findAnnotationMirror(Element annotatedElement,
                                             String annotationName)

isAnnotation

public boolean isAnnotation(TypeElement annotation,
                            String annotationName)

printAnnotationError

public void printAnnotationError(Element annotatedElement,
                                 String annotationName,
                                 String message)

printAnnotationWarning

public void printAnnotationWarning(Element annotatedElement,
                                   String annotationName,
                                   String message)

printAnnotationMessage

public void printAnnotationMessage(Level level,
                                   Element annotatedElement,
                                   String annotationName,
                                   String message)

printError

public void printError(Element element,
                       String message)

isPrivate

public boolean isPrivate(Element element)

isPublic

public boolean isPublic(Element element)

isAbstract

public boolean isAbstract(Element element)

isInterface

public boolean isInterface(TypeElement element)

isTopLevel

public boolean isTopLevel(TypeElement element)

isFinal

public boolean isFinal(Element element)

isSynchronized

public boolean isSynchronized(Element element)

getElementUtils

public Elements getElementUtils()

getTypeUtils

public Types getTypeUtils()

extractAnnotationFieldRefs

public List<com.sun.codemodel.JFieldRef> extractAnnotationFieldRefs(ProcessHolder holder,
                                                                    Element element,
                                                                    String annotationName,
                                                                    IRInnerClass rInnerClass,
                                                                    boolean useElementName)
Returns a list of JFieldRef linking to the R class, based on the given annotation

See Also:
extractAnnotationResources(Element, String, IRInnerClass, boolean)

extractAnnotationResources

public List<String> extractAnnotationResources(Element element,
                                               String annotationName,
                                               IRInnerClass rInnerClass,
                                               boolean useElementName)
Method to handle all annotations dealing with resource ids that can be set using the value() parameter of the annotation (as int or int[]), the resName() parameter of the annotation (as String or String[]), the element name.

Parameters:
element - the annotated element
annotationName - the annotation on the element
rInnerClass - the R innerClass the resources belong to
useElementName - Should we use a default fallback strategy that uses the element qualified name for a resource name
Returns:
the qualified names of the matching resources in the R inner class

extractElementName

public String extractElementName(Element element,
                                 String annotationName)

defaultResName

public boolean defaultResName(String[] resNames)

defaultResIdValue

public boolean defaultResIdValue(int[] values)

extractAnnotationResNameParameter

public String[] extractAnnotationResNameParameter(Element element,
                                                  String annotationName)

extractAnnotationResIdValueParameter

public int[] extractAnnotationResIdValueParameter(Element element,
                                                  String annotationName)

extractAnnotationParameter

public <T> T extractAnnotationParameter(Element element,
                                        String annotationName,
                                        String methodName)

actionName

public String actionName(String annotationName)

extractAnnotationClassArrayParameter

public List<DeclaredType> extractAnnotationClassArrayParameter(Element element,
                                                               String annotationName,
                                                               String methodName)

extractAnnotationClassParameter

public DeclaredType extractAnnotationClassParameter(Element element,
                                                    String annotationName,
                                                    String methodName)

extractAnnotationClassParameter

public DeclaredType extractAnnotationClassParameter(Element element,
                                                    String annotationName)

enclosingElementHasEnhancedComponentAnnotation

public boolean enclosingElementHasEnhancedComponentAnnotation(Element element)

hasOneOfClassAnnotations

public boolean hasOneOfClassAnnotations(Element element,
                                        Class<? extends Annotation> validAnnotation)

hasOneOfClassAnnotations

public boolean hasOneOfClassAnnotations(Element element,
                                        List<Class<? extends Annotation>> validAnnotations)


Copyright © 2010-2014. All Rights Reserved.