public abstract class JavaxLangModelUtilities extends Object
Processor
and
Taglet
implementations.Modifier and Type | Field and Description |
---|---|
protected Elements |
elements
|
protected JavaFileManager |
fm
JavacTask JavaFileManager instance. |
static ball.annotation.processing.JavaxLangModelUtilities.ModifierMap |
MODIFIERS |
protected Types |
types
|
Constructor and Description |
---|
JavaxLangModelUtilities() |
public static final ball.annotation.processing.JavaxLangModelUtilities.ModifierMap MODIFIERS
protected JavaFileManager fm
JavacTask
JavaFileManager
instance.public JavaxLangModelUtilities()
protected ClassLoader getClassLoader()
ClassLoader
for loading dependencies.ClassLoader
.protected Class<?> asClass(TypeElement element)
Class
corresponding to a
TypeElement
.element
- The TypeElement
.Class
for the TypeElement
.protected Class<?> asPackageInfoClass(PackageElement element)
element
- The PackageElement
.Class
for the PackageElement
package-info.class
.protected TypeElement asTypeElement(Class<?> type)
TypeElement
for a Class
.type
- The Class
.TypeElement
for the Class
.protected ExecutableElement asExecutableElement(Constructor<?> constructor)
ExecutableElement
for a Constructor
.constructor
- The Constructor
.ExecutableElement
for the Constructor
.protected ExecutableElement asExecutableElement(Method method)
ExecutableElement
for a Method
.method
- The Method
.ExecutableElement
for the Method
.@Deprecated protected ExecutableElement getMethod(Method method)
protected VariableElement asVariableElement(Field field)
VariableElement
for a Field
.field
- The Field
.VariableElement
for the Field
.protected TypeMirror asTypeMirror(Class<?> type)
TypeMirror
for a Class
.type
- The Class
.TypeMirror
for the Class
.protected List<TypeMirror> asTypeMirrorList(Class<?>... types)
types
- The array of Class
es.List
of TypeMirror
s.protected TypeElement getEnclosingTypeElement(Element element)
TypeElement
for an
Element
.element
- The Element
.TypeElement
.protected TypeElement getTypeElementFor(Element context, String name)
TypeElement
for a context Element
.context
- The context Element
.name
- The name of the Element
(Class
).TypeElement
.protected ExecutableElement getConstructor(TypeElement type, List<TypeMirror> parameters)
type
- The TypeElement
.parameters
- The constructor parameter types.ExecutableElement
for the constructor.protected ExecutableElement getMethod(TypeElement type, Method method)
ExecutableElement
for a Method
prototype.type
- The TypeElement
.method
- The prototype Method
.ExecutableElement
for the method.protected ExecutableElement overrides(ExecutableElement overrider)
overrider
- The ExecutableElement
.ExecutableElement
if any;
null
otherwise.Elements.overrides(ExecutableElement,ExecutableElement,TypeElement)
protected boolean overrides(ExecutableElement overrider, ExecutableElement overridden)
overrider
- The (possibly) overriding
ExecutableElement
.overridden
- The overridden ExecutableElement
.true
if overrider
overrides
overridden
; false
otherwise.Elements.overrides(ExecutableElement,ExecutableElement,TypeElement)
protected ExecutableElement implementationOf(ExecutableElement overridden, TypeElement type)
ExecutableElement
(Method
) the argument
ExecutableElement
is overriden by (if any).overridden
- The ExecutableElement
.type
- The TypeElement
.ExecutableElement
if any;
null
otherwise.overrides(ExecutableElement)
protected ExecutableElement specifiedBy(ExecutableElement method)
ExecutableElement
(Method
) the argument
ExecutableElement
is specified by (if any).method
- The ExecutableElement
.ExecutableElement
if any;
null
otherwise.overrides(ExecutableElement)
protected String signature(Executable executable)
Executable
.executable
- The Executable
.String
.protected String signature(ExecutableElement element)
ExecutableElement
.element
- The ExecutableElement
.String
.protected AnnotationMirror getAnnotationMirror(Element element, Class<? extends Annotation> type)
Element
's AnnotationMirror
.element
- The annotated Element
.type
- The Annotation
type (Class
).AnnotationMirror
if the Element
is
annotated with the argument annotation; null
otherwise.Element.getAnnotationMirrors()
protected AnnotationMirror getAnnotationMirror(Element element, TypeElement type)
Element
's AnnotationMirror
.element
- The annotated Element
.type
- The Annotation
type
(TypeElement
).AnnotationMirror
if the Element
is
annotated with the argument annotation; null
otherwise.Element.getAnnotationMirrors()
protected AnnotationValue getAnnotationValue(AnnotationMirror annotation, String name)
AnnotationMirror
element's
AnnotationValue
.annotation
- The AnnotationMirror
.name
- The simple name of the element.AnnotationValue
if it is defined; null
otherwise.Elements.getElementValuesWithDefaults(AnnotationMirror)
protected boolean isEmptyArray(AnnotationValue value)
AnnotationValue
is "empty":
null
or an empty array.value
- The AnnotationValue
.true
if empty; {code false} otherwise.protected String getPropertyName(ExecutableElement element)
ExecutableElement
.element
- The ExecutableElement
.String
if the ExecutableElement
is a getter or setter method; null
otherwise.protected boolean isGetterMethod(ExecutableElement element)
ExecutableElement
is a bean getter.element
- The ExecutableElement
.true
if the Element
has a non-private getter
method; false
otherwise.protected Set<String> getPropertyNames(TypeElement type)
Set
of bean property names for the
specified TypeElement
.type
- The TypeElement
to analyze.Set
of bean property names.protected Predicate<Element> hasSameSignatureAs(List<TypeMirror> parameters)
protected Predicate<Element> hasSameSignatureAs(Executable executable)
protected Predicate<Element> hasSameSignatureAs(CharSequence name, Class<?>[] parameters)
protected Predicate<Element> isAssignableTo(Class<?> type)
protected Predicate<Element> isAssignableTo(TypeMirror type)
protected Predicate<Element> isAssignableTo(Class<?> type, Function<? super Element,TypeMirror> extractor)
protected Predicate<Element> isAssignableTo(TypeMirror type, Function<? super Element,TypeMirror> extractor)
protected Predicate<Element> named(CharSequence name)
protected Predicate<Element> withParameters(Class<?>[] parameters)
protected Predicate<Element> withParameters(List<TypeMirror> parameters)
protected Predicate<Element> withModifiers(Modifier... modifiers)
protected Predicate<Element> withModifiers(Set<Modifier> modifiers)
protected Predicate<Element> withoutModifiers(Modifier... modifiers)
protected Predicate<Element> withoutModifiers(Set<Modifier> modifiers)
protected <E> Predicate<Element> without(Set<E> set, Function<Element,Collection<E>> extractor)
protected ClassLoader getClassPathClassLoader(JavaFileManager fm, ClassLoader parent)
fm
- The JavaFileManager
.parent
- The parent ClassLoader
.ClassLoader
.protected ClassLoader getClassPathClassLoader(JavaFileManager fm)
fm
- The JavaFileManager
.ClassLoader
.public static int toModifiers(Set<Modifier> set)
set
- The Modifier
s.Copyright © 2015–2021. All rights reserved.