public class AptSourceUtils extends Object implements SourceUtils
Implementation to use in annotation processor.
| Modifier and Type | Class and Description |
|---|---|
protected class |
AptSourceUtils.AptBeanProperty
|
SourceUtils.ACCESS_TYPE, SourceUtils.BeanProperty, SourceUtils.SuperTypeVisitor| Constructor and Description |
|---|
AptSourceUtils(ProcessingEnvironment processingEnv)
|
| 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 componentElement,
String name)
|
String |
getDocComment(Element componentElement)
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)
Set model property to the corresponding annotation attribute, if annotation attribute set to non-default value. |
void |
setModelProperty(Object model,
AnnotationMirror annotation,
String modelProperty,
String annotationAttribute)
Set model property to the corresponding annotation attribute, if annotation attribute set to non-default value. |
void |
visitSupertypes(TypeElement type,
SourceUtils.SuperTypeVisitor visitor)
|
public AptSourceUtils(ProcessingEnvironment processingEnv)
processingEnv - public Set<SourceUtils.BeanProperty> getBeanPropertiesAnnotatedWith(Class<? extends Annotation> annotation, TypeElement type)
Get all fields and bean properties that are annotated with given annotation.
getBeanPropertiesAnnotatedWith in interface SourceUtilsannotation - type - public Set<SourceUtils.BeanProperty> getAbstractBeanProperties(TypeElement type)
SourceUtils
getAbstractBeanProperties in interface SourceUtilspublic SourceUtils.BeanProperty getBeanProperty(ClassName type, String name)
SourceUtilsGet bean property descriptor for particular type.
getBeanProperty in interface SourceUtilspublic SourceUtils.BeanProperty getBeanProperty(TypeElement type, String name)
SourceUtilsGet bean property descriptor for particular type.
getBeanProperty in interface SourceUtilspublic String getDocComment(Element componentElement)
SourceUtilsGet JavaDoc comments associated with given element.
getDocComment in interface SourceUtilspublic AnnotationMirror getAnnotationMirror(Element element, Class<? extends Annotation> annotationType)
SourceUtilsGet model representation of the annotation for given model element
getAnnotationMirror in interface SourceUtilspublic boolean isAnnotationPresent(Element element, Class<? extends Annotation> annotationType)
SourceUtilsCheck model element for presense of annotation.
isAnnotationPresent in interface SourceUtilspublic boolean isAnnotationPropertyPresent(AnnotationMirror annotation, String propertyName)
SourceUtils
isAnnotationPropertyPresent in interface SourceUtilspublic boolean isDefaultValue(AnnotationMirror annotation, String propertyName)
SourceUtilsCheck annotation proprrty for default value.
isDefaultValue in interface SourceUtilspublic <T> T getAnnotationValue(AnnotationMirror annotation, String propertyName, Class<T> expectedType)
SourceUtils
getAnnotationValue in interface SourceUtilspublic <T> Iterable<T> getAnnotationValues(AnnotationMirror annotation, String propertyName, Class<T> expectedType)
SourceUtils
getAnnotationValues in interface SourceUtilspublic void setModelProperty(Object model, AnnotationMirror annotation, String modelProperty)
Set model property to the corresponding annotation attribute, if annotation attribute set to non-default value.
setModelProperty in interface SourceUtilsmodel - Model object.annotation - annotation to copy property from.modelProperty - bean attribute name in the model and annotation.public void setModelProperty(Object model, AnnotationMirror annotation, String modelProperty, String annotationAttribute)
Set model property to the corresponding annotation attribute, if annotation attribute set to non-default value.
setModelProperty in interface SourceUtilsmodel - Model object.annotation - annotation to copy property from.modelProperty - bean attribute name in model.annotationAttribute - annotation attribute name.public Object getConstant(TypeElement componentElement, String name)
SourceUtils
getConstant in interface SourceUtilspublic void visitSupertypes(TypeElement type, SourceUtils.SuperTypeVisitor visitor)
SourceUtils
visitSupertypes in interface SourceUtilspublic boolean isClassExists(ClassName type)
SourceUtils
isClassExists in interface SourceUtilspublic TypeElement asTypeElement(TypeMirror mirror)
SourceUtilsConverts TypeMirror into corresponding TypeElement
asTypeElement in interface SourceUtilsCopyright © 2014 JBoss by Red Hat. All Rights Reserved.