com.googlecode.androidannotations.helper
Class AnnotationHelper

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

public class AnnotationHelper
extends Object


Constructor Summary
AnnotationHelper(ProcessingEnvironment processingEnv)
           
 
Method Summary
 String actionName(Class<? extends Annotation> target)
           
 boolean defaultResIdValue(int[] values)
           
 boolean defaultResName(String[] resNames)
           
 List<DeclaredType> extractAnnotationClassArrayParameter(Element element, Class<? extends Annotation> target, String methodName)
           
 DeclaredType extractAnnotationClassParameter(Element element, Class<? extends Annotation> target)
           
 DeclaredType extractAnnotationClassParameter(Element element, Class<? extends Annotation> target, String methodName)
           
 List<com.sun.codemodel.JFieldRef> extractAnnotationFieldRefs(EBeanHolder holder, Element element, Class<? extends Annotation> target, IRInnerClass rInnerClass, boolean useElementName)
          Returns a list of JFieldRef linking to the R class, based on the given annotation
<T> T
extractAnnotationParameter(Element element, Class<? extends Annotation> target, String methodName)
           
 int[] extractAnnotationResIdValueParameter(Element element, Class<? extends Annotation> target)
           
 String[] extractAnnotationResNameParameter(Element element, Class<? extends Annotation> target)
           
 List<String> extractAnnotationResources(Element element, Class<? extends Annotation> target, 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, Class<? extends Annotation> target)
           
 AnnotationMirror findAnnotationMirror(Element annotatedElement, Class<? extends Annotation> annotationClass)
           
 Elements getElementUtils()
           
 Types getTypeUtils()
           
 boolean isAbstract(Element element)
           
 boolean isAnnotation(TypeElement annotation, Class<? extends Annotation> annotationClass)
           
 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, Class<? extends Annotation> annotationClass, String message)
           
 void printAnnotationMessage(Diagnostic.Kind diagnosticKind, Element annotatedElement, Class<? extends Annotation> annotationClass, String message)
           
 void printAnnotationWarning(Element annotatedElement, Class<? extends Annotation> annotationClass, 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,
                                             Class<? extends Annotation> annotationClass)

isAnnotation

public boolean isAnnotation(TypeElement annotation,
                            Class<? extends Annotation> annotationClass)

printAnnotationError

public void printAnnotationError(Element annotatedElement,
                                 Class<? extends Annotation> annotationClass,
                                 String message)

printAnnotationWarning

public void printAnnotationWarning(Element annotatedElement,
                                   Class<? extends Annotation> annotationClass,
                                   String message)

printAnnotationMessage

public void printAnnotationMessage(Diagnostic.Kind diagnosticKind,
                                   Element annotatedElement,
                                   Class<? extends Annotation> annotationClass,
                                   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(EBeanHolder holder,
                                                                    Element element,
                                                                    Class<? extends Annotation> target,
                                                                    IRInnerClass rInnerClass,
                                                                    boolean useElementName)
Returns a list of JFieldRef linking to the R class, based on the given annotation

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

extractAnnotationResources

public List<String> extractAnnotationResources(Element element,
                                               Class<? extends Annotation> target,
                                               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
target - 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,
                                 Class<? extends Annotation> target)

defaultResName

public boolean defaultResName(String[] resNames)

defaultResIdValue

public boolean defaultResIdValue(int[] values)

extractAnnotationResNameParameter

public String[] extractAnnotationResNameParameter(Element element,
                                                  Class<? extends Annotation> target)

extractAnnotationResIdValueParameter

public int[] extractAnnotationResIdValueParameter(Element element,
                                                  Class<? extends Annotation> target)

extractAnnotationParameter

public <T> T extractAnnotationParameter(Element element,
                                        Class<? extends Annotation> target,
                                        String methodName)

actionName

public String actionName(Class<? extends Annotation> target)

extractAnnotationClassArrayParameter

public List<DeclaredType> extractAnnotationClassArrayParameter(Element element,
                                                               Class<? extends Annotation> target,
                                                               String methodName)

extractAnnotationClassParameter

public DeclaredType extractAnnotationClassParameter(Element element,
                                                    Class<? extends Annotation> target,
                                                    String methodName)

extractAnnotationClassParameter

public DeclaredType extractAnnotationClassParameter(Element element,
                                                    Class<? extends Annotation> target)


Copyright © 2010-2013. All Rights Reserved.