public class ModelUtils extends Object
| Constructor and Description |
|---|
ModelUtils() |
| Modifier and Type | Method and Description |
|---|---|
static TypeElement |
asElement(DeclaredType type)
Returns the
TypeElement corresponding to type. |
static com.google.common.base.Optional<AnnotationMirror> |
findAnnotationMirror(Element element,
Class<? extends 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<AnnotationMirror> |
findAnnotationMirror(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<AnnotationMirror> |
findAnnotationMirror(Element element,
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<AnnotationValue> |
findProperty(AnnotationMirror annotation,
String propertyName) |
static com.google.common.base.Optional<TypeElement> |
maybeAsTypeElement(TypeMirror type)
Returns the
TypeElement corresponding to type, if there is one. |
static com.google.common.base.Optional<DeclaredType> |
maybeDeclared(TypeMirror type)
Returns
type as a DeclaredType, if it is one. |
static com.google.common.base.Optional<TypeElement> |
maybeType(Element element)
Returns
element as a TypeElement, if it is one. |
static com.google.common.base.Optional<TypeMirror> |
maybeUnbox(TypeMirror mirror,
Types types)
Applies unboxing conversion to
mirror, if it can be unboxed. |
static com.google.common.base.Optional<TypeVariable> |
maybeVariable(TypeMirror type) |
static boolean |
overrides(TypeElement type,
Types types,
String methodName,
TypeMirror... params)
Returns whether
type overrides method methodName(params). |
public static com.google.common.base.Optional<AnnotationMirror> findAnnotationMirror(Element element, Class<? extends 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<AnnotationMirror> findAnnotationMirror(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<AnnotationMirror> findAnnotationMirror(Element element, 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<AnnotationValue> findProperty(AnnotationMirror annotation, String propertyName)
public static com.google.common.base.Optional<TypeElement> maybeType(Element element)
element as a TypeElement, if it is one.public static com.google.common.base.Optional<DeclaredType> maybeDeclared(TypeMirror type)
type as a DeclaredType, if it is one.public static com.google.common.base.Optional<TypeVariable> maybeVariable(TypeMirror type)
public static com.google.common.base.Optional<TypeElement> maybeAsTypeElement(TypeMirror type)
TypeElement corresponding to type, if there is one.public static TypeElement asElement(DeclaredType type)
TypeElement corresponding to type.public static com.google.common.base.Optional<TypeMirror> maybeUnbox(TypeMirror mirror, Types types)
mirror, if it can be unboxed.public static boolean overrides(TypeElement type, Types types, String methodName, TypeMirror... params)
type overrides method methodName(params).Copyright © 2016 Google, Inc.. All rights reserved.