public interface SourceUtils
This class provides utility methods to analayze java classes. This implementation uses APT API to get information about Java code.
| Modifier and Type | Interface and Description |
|---|---|
static class |
SourceUtils.ACCESS_TYPE |
static interface |
SourceUtils.BeanProperty
|
static interface |
SourceUtils.SuperTypeVisitor
|
| Modifier and Type | Method and Description |
|---|---|
TypeElement |
asTypeElement(TypeMirror mirror)
Converts TypeMirror into corresponding TypeElement |
Set<SourceUtils.BeanProperty> |
getAbstractBeanProperties(TypeElement type)
|
AnnotationMirror |
getAnnotationMirror(Element element,
Class<? extends Annotation> annotationType)
Get model representation of the annotation for given model element |
<T> T |
getAnnotationValue(AnnotationMirror annotation,
String propertyName,
Class<T> expectedType)
|
<T> Iterable<T> |
getAnnotationValues(AnnotationMirror annotation,
String propertyName,
Class<T> expectedType)
|
Set<SourceUtils.BeanProperty> |
getBeanPropertiesAnnotatedWith(Class<? extends Annotation> annotation,
TypeElement type)
Get all fields and bean properties that are annotated with given annotation. |
SourceUtils.BeanProperty |
getBeanProperty(ClassName type,
String name)
Get bean property descriptor for particular type. |
SourceUtils.BeanProperty |
getBeanProperty(TypeElement type,
String name)
Get bean property descriptor for particular type. |
Object |
getConstant(TypeElement element,
String name)
|
String |
getDocComment(Element element)
Get JavaDoc comments associated with given element. |
boolean |
isAnnotationPresent(Element element,
Class<? extends Annotation> annotationType)
Check model element for presense of annotation. |
boolean |
isAnnotationPropertyPresent(AnnotationMirror annotation,
String propertyName)
|
boolean |
isClassExists(ClassName type)
|
boolean |
isDefaultValue(AnnotationMirror annotation,
String propertyName)
Check annotation proprrty for default value. |
void |
setModelProperty(Object model,
AnnotationMirror annotation,
String modelProperty)
|
void |
setModelProperty(Object model,
AnnotationMirror annotation,
String modelProperty,
String annotationAttribute)
|
void |
visitSupertypes(TypeElement type,
SourceUtils.SuperTypeVisitor visitor)
|
Set<SourceUtils.BeanProperty> getBeanPropertiesAnnotatedWith(Class<? extends Annotation> annotation, TypeElement type)
Get all fields and bean properties that are annotated with given annotation.
annotation - type - Set<SourceUtils.BeanProperty> getAbstractBeanProperties(TypeElement type)
type - SourceUtils.BeanProperty getBeanProperty(TypeElement type, String name)
Get bean property descriptor for particular type.
type - name - SourceUtils.BeanProperty getBeanProperty(ClassName type, String name)
Get bean property descriptor for particular type.
type - name - String getDocComment(Element element)
Get JavaDoc comments associated with given element.
componentElement - boolean isAnnotationPresent(Element element, Class<? extends Annotation> annotationType)
Check model element for presense of annotation.
element - annotationType - AnnotationMirror getAnnotationMirror(Element element, Class<? extends Annotation> annotationType)
Get model representation of the annotation for given model element
annotationType - <T> T getAnnotationValue(AnnotationMirror annotation, String propertyName, Class<T> expectedType)
annotation - propertyName - <T> Iterable<T> getAnnotationValues(AnnotationMirror annotation, String propertyName, Class<T> expectedType)
annotation - propertyName - boolean isAnnotationPropertyPresent(AnnotationMirror annotation, String propertyName)
annotation - propertyName - boolean isDefaultValue(AnnotationMirror annotation, String propertyName)
Check annotation proprrty for default value.
annotation - propertyName - void setModelProperty(Object model, AnnotationMirror annotation, String modelProperty, String annotationAttribute)
model - annotation - modelProperty - annotationAttribute - void setModelProperty(Object model, AnnotationMirror annotation, String modelProperty)
model - annotation - modelProperty - Object getConstant(TypeElement element, String name)
componentElement - name - void visitSupertypes(TypeElement type, SourceUtils.SuperTypeVisitor visitor)
type - visitor - TypeElement asTypeElement(TypeMirror mirror)
Converts TypeMirror into corresponding TypeElement
mirror - boolean isClassExists(ClassName type)
type - Copyright © 2014 JBoss by Red Hat. All Rights Reserved.