org.richfaces.cdk.apt
Class ReflectionUtils

java.lang.Object
  extended by org.richfaces.cdk.apt.ReflectionUtils
All Implemented Interfaces:
SourceUtils

public class ReflectionUtils
extends java.lang.Object
implements SourceUtils

Author:
asmirnov@exadel.com

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.richfaces.cdk.apt.SourceUtils
SourceUtils.BeanProperty, SourceUtils.SuperTypeVisitor
 
Constructor Summary
ReflectionUtils()
           
 
Method Summary
 javax.lang.model.element.TypeElement asTypeElement(ClassName type)
          

 javax.lang.model.element.TypeElement asTypeElement(javax.lang.model.type.TypeMirror mirror)
          

Converts TypeMirror into corresponding TypeElement

 java.util.Set<SourceUtils.BeanProperty> getAbstractBeanProperties(javax.lang.model.element.TypeElement type)
          

 javax.lang.model.element.AnnotationMirror getAnnotationMirror(javax.lang.model.element.Element element, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          

Get model representation of the annotation for given model element

<T> T
getAnnotationValue(javax.lang.model.element.AnnotationMirror annotation, java.lang.String propertyName, java.lang.Class<T> expectedType)
          

<T> java.util.List<T>
getAnnotationValues(javax.lang.model.element.AnnotationMirror annotation, java.lang.String propertyName, java.lang.Class<T> expectedType)
          

 java.util.Set<SourceUtils.BeanProperty> getBeanPropertiesAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, javax.lang.model.element.TypeElement type)
          

Get all fields and bean properties that are annotated with given annotation.

 java.lang.Object getConstant(javax.lang.model.element.TypeElement element, java.lang.String name)
          

 java.lang.String getDocComment(javax.lang.model.element.Element element)
          

Get JavaDoc comments associated with given element.

 boolean isAnnotationPresent(javax.lang.model.element.Element element, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          

Check model element for presense of annotation.

 boolean isAnnotationPropertyPresent(javax.lang.model.element.AnnotationMirror annotation, java.lang.String propertyName)
           
 boolean isDefaultValue(javax.lang.model.element.AnnotationMirror annotation, java.lang.String propertyName)
          

Check annotation proprrty for default value.

 void setModelProperty(java.lang.Object model, javax.lang.model.element.AnnotationMirror annotation, java.lang.String modelProperty)
           
 void setModelProperty(java.lang.Object model, javax.lang.model.element.AnnotationMirror annotation, java.lang.String modelProperty, java.lang.String annotationAttribute)
           
 void visitSupertypes(javax.lang.model.element.TypeElement type, SourceUtils.SuperTypeVisitor visitor)
          

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionUtils

public ReflectionUtils()
Method Detail

asTypeElement

public javax.lang.model.element.TypeElement asTypeElement(javax.lang.model.type.TypeMirror mirror)
Description copied from interface: SourceUtils

Converts TypeMirror into corresponding TypeElement

Specified by:
asTypeElement in interface SourceUtils
Returns:

asTypeElement

public javax.lang.model.element.TypeElement asTypeElement(ClassName type)
Description copied from interface: SourceUtils

Specified by:
asTypeElement in interface SourceUtils
Returns:

getAbstractBeanProperties

public java.util.Set<SourceUtils.BeanProperty> getAbstractBeanProperties(javax.lang.model.element.TypeElement type)
Description copied from interface: SourceUtils

Specified by:
getAbstractBeanProperties in interface SourceUtils
Returns:

getBeanPropertiesAnnotatedWith

public java.util.Set<SourceUtils.BeanProperty> getBeanPropertiesAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> annotation,
                                                                              javax.lang.model.element.TypeElement type)
Description copied from interface: SourceUtils

Get all fields and bean properties that are annotated with given annotation.

Specified by:
getBeanPropertiesAnnotatedWith in interface SourceUtils
Returns:

getConstant

public java.lang.Object getConstant(javax.lang.model.element.TypeElement element,
                                    java.lang.String name)
Description copied from interface: SourceUtils

Specified by:
getConstant in interface SourceUtils
Returns:

getDocComment

public java.lang.String getDocComment(javax.lang.model.element.Element element)
Description copied from interface: SourceUtils

Get JavaDoc comments associated with given element.

Specified by:
getDocComment in interface SourceUtils
Returns:

visitSupertypes

public void visitSupertypes(javax.lang.model.element.TypeElement type,
                            SourceUtils.SuperTypeVisitor visitor)
Description copied from interface: SourceUtils

Specified by:
visitSupertypes in interface SourceUtils

getAnnotationMirror

public javax.lang.model.element.AnnotationMirror getAnnotationMirror(javax.lang.model.element.Element element,
                                                                     java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Description copied from interface: SourceUtils

Get model representation of the annotation for given model element

Specified by:
getAnnotationMirror in interface SourceUtils
Returns:

isAnnotationPresent

public boolean isAnnotationPresent(javax.lang.model.element.Element element,
                                   java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Description copied from interface: SourceUtils

Check model element for presense of annotation.

Specified by:
isAnnotationPresent in interface SourceUtils
Returns:

getAnnotationValue

public <T> T getAnnotationValue(javax.lang.model.element.AnnotationMirror annotation,
                                java.lang.String propertyName,
                                java.lang.Class<T> expectedType)
Description copied from interface: SourceUtils

Specified by:
getAnnotationValue in interface SourceUtils
Returns:

getAnnotationValues

public <T> java.util.List<T> getAnnotationValues(javax.lang.model.element.AnnotationMirror annotation,
                                                 java.lang.String propertyName,
                                                 java.lang.Class<T> expectedType)
Description copied from interface: SourceUtils

Specified by:
getAnnotationValues in interface SourceUtils
Returns:

isDefaultValue

public boolean isDefaultValue(javax.lang.model.element.AnnotationMirror annotation,
                              java.lang.String propertyName)
Description copied from interface: SourceUtils

Check annotation proprrty for default value.

Specified by:
isDefaultValue in interface SourceUtils
Returns:
true if property has its default value.

isAnnotationPropertyPresent

public boolean isAnnotationPropertyPresent(javax.lang.model.element.AnnotationMirror annotation,
                                           java.lang.String propertyName)
Specified by:
isAnnotationPropertyPresent in interface SourceUtils

setModelProperty

public void setModelProperty(java.lang.Object model,
                             javax.lang.model.element.AnnotationMirror annotation,
                             java.lang.String modelProperty,
                             java.lang.String annotationAttribute)
Specified by:
setModelProperty in interface SourceUtils

setModelProperty

public void setModelProperty(java.lang.Object model,
                             javax.lang.model.element.AnnotationMirror annotation,
                             java.lang.String modelProperty)
Specified by:
setModelProperty in interface SourceUtils


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.