Top Description Fields Constructors Methods
com.google.auto.common

public final Class SuperficialValidation

extends Object
Class Inheritance
Imports
java.util.List, .Map, java.util.stream.StreamSupport, javax.lang.model.element.AnnotationMirror, .AnnotationValue, .AnnotationValueVisitor, .Element, .ElementVisitor, .ExecutableElement, .PackageElement, .TypeElement, .TypeParameterElement, .VariableElement, javax.lang.model.type.ArrayType, .DeclaredType, .ErrorType, .ExecutableType, .TypeKind, .TypeMirror, .TypeVisitor, .WildcardType, javax.lang.model.util.AbstractElementVisitor8, .SimpleAnnotationValueVisitor8, .SimpleTypeVisitor8

A utility class that traverses Element instances and ensures that all type information is present and resolvable.
Author
Gregory Kick

Field Summary

Modifier and TypeField and Description
private static final ElementVisitor<Boolean, Void>
private static final TypeVisitor<Boolean, Void>
private static final AnnotationValueVisitor<Boolean, TypeMirror>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static boolean
private static boolean
private static boolean
validateAnnotations(Iterable<? extends AnnotationMirror> annotationMirrors)

private static boolean
validateAnnotationValue(AnnotationValue annotationValue, TypeMirror expectedType)

private static boolean
public static boolean
validateElement(Element element)

Returns true if all types referenced by the given element are defined.

public static boolean
validateElements(Iterable<? extends Element> elements)

Returns true if all of the given elements return true from validateElement(Element).

public static boolean
validateType(TypeMirror type)

Returns true if the given type is fully defined.

private static boolean
validateTypes(Iterable<? extends TypeMirror> types)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ELEMENT_VALIDATING_VISITORback to summary
private static final ElementVisitor<Boolean, Void> ELEMENT_VALIDATING_VISITOR
TYPE_VALIDATING_VISITORback to summary
private static final TypeVisitor<Boolean, Void> TYPE_VALIDATING_VISITOR
VALUE_VALIDATING_VISITORback to summary
private static final AnnotationValueVisitor<Boolean, TypeMirror> VALUE_VALIDATING_VISITOR

Constructor Detail

SuperficialValidationback to summary
private SuperficialValidation()

Method Detail

isValidBaseElementback to summary
private static boolean isValidBaseElement(Element e)
validateAnnotationback to summary
private static boolean validateAnnotation(AnnotationMirror annotationMirror)
validateAnnotationsback to summary
private static boolean validateAnnotations(Iterable<? extends AnnotationMirror> annotationMirrors)
validateAnnotationValueback to summary
private static boolean validateAnnotationValue(AnnotationValue annotationValue, TypeMirror expectedType)
validateAnnotationValuesback to summary
private static boolean validateAnnotationValues(Map<? extends ExecutableElement, ? extends AnnotationValue> valueMap)
validateElementback to summary
public static boolean validateElement(Element element)

Returns true if all types referenced by the given element are defined. The exact meaning of this depends on the kind of element. For packages, it means that all annotations on the package are fully defined. For other element kinds, it means that types referenced by the element, anything it contains, and any of its annotations element are all defined.

validateElementsback to summary
public static boolean validateElements(Iterable<? extends Element> elements)

Returns true if all of the given elements return true from validateElement(Element).

validateTypeback to summary
public static boolean validateType(TypeMirror type)

Returns true if the given type is fully defined. This means that the type itself is defined, as are any types it references, such as any type arguments or type bounds. For an ExecutableType, the parameter and return types must be fully defined, as must types declared in a throws clause or in the bounds of any type parameters.

validateTypesback to summary
private static boolean validateTypes(Iterable<? extends TypeMirror> types)