public class ModelUtils
extends java.lang.Object
| Constructor and Description |
|---|
ModelUtils() |
| Modifier and Type | Method and Description |
|---|---|
static javax.lang.model.element.TypeElement |
asElement(javax.lang.model.type.DeclaredType type)
Returns the
TypeElement corresponding to type. |
static com.google.common.base.Optional<javax.lang.model.element.AnnotationMirror> |
findAnnotationMirror(javax.lang.model.element.Element element,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Returns an
AnnotationMirror for the annotation of type annotationClass on
element, or Optional.absent() if no such annotation exists. |
static com.google.common.base.Optional<javax.lang.model.element.AnnotationMirror> |
findAnnotationMirror(javax.lang.model.element.Element element,
QualifiedName annotationClass)
Returns an
AnnotationMirror for the annotation of type annotationClass on
element, or Optional.absent() if no such annotation exists. |
static com.google.common.base.Optional<javax.lang.model.element.AnnotationMirror> |
findAnnotationMirror(javax.lang.model.element.Element element,
java.lang.String annotationClassName)
Returns an
AnnotationMirror for the annotation of type annotationClassName on
element, or Optional.absent() if no such annotation exists. |
static com.google.common.base.Optional<javax.lang.model.element.AnnotationValue> |
findProperty(javax.lang.model.element.AnnotationMirror annotation,
java.lang.String propertyName) |
static com.google.common.base.Optional<javax.lang.model.element.TypeElement> |
maybeAsTypeElement(javax.lang.model.type.TypeMirror type)
Returns the
TypeElement corresponding to type, if there is one. |
static com.google.common.base.Optional<javax.lang.model.type.DeclaredType> |
maybeDeclared(javax.lang.model.type.TypeMirror type)
Returns
type as a DeclaredType, if it is one. |
static com.google.common.base.Optional<javax.lang.model.element.TypeElement> |
maybeType(javax.lang.model.element.Element element)
Returns
element as a TypeElement, if it is one. |
static com.google.common.base.Optional<javax.lang.model.type.TypeMirror> |
maybeUnbox(javax.lang.model.type.TypeMirror mirror,
javax.lang.model.util.Types types)
Applies unboxing conversion to
mirror, if it can be unboxed. |
static com.google.common.base.Optional<javax.lang.model.type.TypeVariable> |
maybeVariable(javax.lang.model.type.TypeMirror type) |
static boolean |
overrides(javax.lang.model.element.TypeElement type,
javax.lang.model.util.Types types,
java.lang.String methodName,
javax.lang.model.type.TypeMirror... params)
Returns whether
type overrides method methodName(params). |
public static com.google.common.base.Optional<javax.lang.model.element.AnnotationMirror> findAnnotationMirror(javax.lang.model.element.Element element,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
AnnotationMirror for the annotation of type annotationClass on
element, or Optional.absent() if no such annotation exists.public static com.google.common.base.Optional<javax.lang.model.element.AnnotationMirror> findAnnotationMirror(javax.lang.model.element.Element element,
QualifiedName annotationClass)
AnnotationMirror for the annotation of type annotationClass on
element, or Optional.absent() if no such annotation exists.public static com.google.common.base.Optional<javax.lang.model.element.AnnotationMirror> findAnnotationMirror(javax.lang.model.element.Element element,
java.lang.String annotationClassName)
AnnotationMirror for the annotation of type annotationClassName on
element, or Optional.absent() if no such annotation exists.public static com.google.common.base.Optional<javax.lang.model.element.AnnotationValue> findProperty(javax.lang.model.element.AnnotationMirror annotation,
java.lang.String propertyName)
public static com.google.common.base.Optional<javax.lang.model.element.TypeElement> maybeType(javax.lang.model.element.Element element)
element as a TypeElement, if it is one.public static com.google.common.base.Optional<javax.lang.model.type.DeclaredType> maybeDeclared(javax.lang.model.type.TypeMirror type)
type as a DeclaredType, if it is one.public static com.google.common.base.Optional<javax.lang.model.type.TypeVariable> maybeVariable(javax.lang.model.type.TypeMirror type)
public static com.google.common.base.Optional<javax.lang.model.element.TypeElement> maybeAsTypeElement(javax.lang.model.type.TypeMirror type)
TypeElement corresponding to type, if there is one.public static javax.lang.model.element.TypeElement asElement(javax.lang.model.type.DeclaredType type)
TypeElement corresponding to type.public static com.google.common.base.Optional<javax.lang.model.type.TypeMirror> maybeUnbox(javax.lang.model.type.TypeMirror mirror,
javax.lang.model.util.Types types)
mirror, if it can be unboxed.public static boolean overrides(javax.lang.model.element.TypeElement type,
javax.lang.model.util.Types types,
java.lang.String methodName,
javax.lang.model.type.TypeMirror... params)
type overrides method methodName(params).