Class MoreAnnotations

java.lang.Object
com.google.errorprone.util.MoreAnnotations

public final class MoreAnnotations extends Object
Annotation-related utilities.
  • Method Details

    • getValue

      public static Optional<com.sun.tools.javac.code.Attribute> getValue(com.sun.tools.javac.code.Attribute.Compound attribute, String name)
      Returns the value of the annotation element-value pair with the given name if it is explicitly set.
    • getAnnotationValue

      public static Optional<AnnotationValue> getAnnotationValue(com.sun.tools.javac.code.Attribute.Compound attribute, String name)
      Returns the value of the annotation element-value pair with the given name if it is explicitly set.
    • asIntegerValue

      public static Optional<Integer> asIntegerValue(AnnotationValue a)
      Converts the given attribute to an integer value.
    • asStringValue

      public static Optional<String> asStringValue(AnnotationValue a)
      Converts the given attribute to an string value.
    • asEnumValue

      public static <T extends Enum<T>> Optional<T> asEnumValue(Class<T> clazz, AnnotationValue a)
      Converts the given attribute to an enum value.
    • asTypeValue

      public static Optional<TypeMirror> asTypeValue(AnnotationValue a)
      Converts the given attribute to a type.
    • asStrings

      public static Stream<String> asStrings(AnnotationValue v)
      Converts the given annotation value to one or more strings.
    • asAnnotations

      public static Stream<AnnotationMirror> asAnnotations(AnnotationValue v)
      Converts the given annotation value to one or more annotations.
    • asTypes

      public static Stream<TypeMirror> asTypes(AnnotationValue v)
      Converts the given annotation value to one or more types.