|
JBoss Logging I18n Annotation Processor 1.1.0.Final | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.logging.processor.util.ElementHelper
public final class ElementHelper
An utility class to work with element.
| Method Summary | |
|---|---|
static Collection<ExecutableElement> |
findByName(Collection<ExecutableElement> methods,
Name methodName)
Returns a collection of methods with the same name. |
static Collection<ExecutableElement> |
findByName(Collection<ExecutableElement> methods,
Name methodName,
int paramCount)
Returns a collection of methods with the same name. |
static Element |
fromMessageObject(MessageObject object)
If the MessageObject.reference() is an instance of Element, then the value is returned, otherwise null is returned. |
static AnnotationValue |
getAnnotationValue(Element element,
String annotation,
String fieldName)
Returns the annotation value for the annotation. |
static String |
getPrimaryClassNamePrefix(TypeElement element)
Returns the primary class simple name prefix for an element who represents a MessageBundle or MessageLogger interface. |
static boolean |
hasCause(Collection<? extends VariableElement> params)
Checks to see if there is a cause parameter. |
static boolean |
inheritsMessage(Collection<ExecutableElement> methods,
ExecutableElement method)
Checks to see if the method has or inherits a Message
annotation. |
static boolean |
isAnnotatedWith(Element element,
Class<? extends Annotation> clazz)
Check if an element is annotated with the given annotation. |
static boolean |
isAnnotatedWith(Element element,
String fqcn)
Check if an element is annotated with the given annotation. |
static boolean |
isOverloaded(Collection<ExecutableElement> methods,
ExecutableElement method)
Checks to see if the method is overloaded. |
static int |
parameterCount(Collection<? extends VariableElement> params)
Returns the number of parameters excluding the Cause parameter
and any Param parameters if found. |
static String |
typeToString(Class<?> type)
Converts a class type to a string recognizable by the Elements.getTypeElement(CharSequence). |
static String |
typeToString(String qualifiedType)
Converts a qualified type name to a string recognizable by the Elements.getTypeElement(CharSequence). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static boolean isAnnotatedWith(Element element,
Class<? extends Annotation> clazz)
element - the element to look for the annotation on.clazz - the annotation class
true if the element is annotated, otherwise false
IllegalArgumentException - if element parameter is null
public static boolean isAnnotatedWith(Element element,
String fqcn)
element - the element to look for the annotation on.fqcn - the fully qualified class name of the annotation
true if the element is annotated, otherwise false
IllegalArgumentException - if element parameter is null
public static AnnotationValue getAnnotationValue(Element element,
String annotation,
String fieldName)
element - the element the annotation is present onannotation - the fully qualified annotation namefieldName - the name of the field/method of the value
null if the annotation was not present or the value was not definedpublic static String getPrimaryClassNamePrefix(TypeElement element)
element - the element
IllegalArgumentException - if element is null or the element is not an interface
public static Collection<ExecutableElement> findByName(Collection<ExecutableElement> methods,
Name methodName)
methods - the methods to process.methodName - the method name to find.
public static Collection<ExecutableElement> findByName(Collection<ExecutableElement> methods,
Name methodName,
int paramCount)
methods - the methods to process.methodName - the method name to find.paramCount - the number of parameters the method must have.
public static boolean hasCause(Collection<? extends VariableElement> params)
params - the parameters to check.
true if there is a cause, otherwise false.public static int parameterCount(Collection<? extends VariableElement> params)
Cause parameter
and any Param parameters if found.
params - the parameters to get the count for.
public static boolean inheritsMessage(Collection<ExecutableElement> methods,
ExecutableElement method)
Message
annotation.
methods - the method to search.method - the method to check.
true if the method has or inherits a message annotation, otherwise false.
public static boolean isOverloaded(Collection<ExecutableElement> methods,
ExecutableElement method)
Cause or
Param
are not counted.
methods - the method to search.method - the method to check.
true if the method is overloaded, otherwise false.public static String typeToString(Class<?> type)
Elements.getTypeElement(CharSequence). Essentially replaces any $'s to
. (dots).
type - the type to convert.
public static String typeToString(String qualifiedType)
Elements.getTypeElement(CharSequence). Essentially replaces any $'s to
. (dots).
qualifiedType - the qualified type name.
public static Element fromMessageObject(MessageObject object)
MessageObject.reference() is an instance of Element, then the value is returned, otherwise null is returned.
object - the object to check the reference on
null
|
JBoss Logging I18n Annotation Processor 1.1.0.Final | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||