Package dagger.hilt.processor.internal
Class AnnotationValues
- java.lang.Object
-
- dagger.hilt.processor.internal.AnnotationValues
-
public final class AnnotationValues extends java.lang.ObjectA utility class for working withAnnotationValueinstances.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.google.common.collect.ImmutableList<javax.lang.model.element.AnnotationValue>getAnnotationValues(javax.lang.model.element.AnnotationValue annotationValue)Returns the list of values represented by an array annotation value.static booleangetBoolean(javax.lang.model.element.AnnotationValue value)Returns the value as a boolean.static javax.lang.model.element.VariableElementgetEnum(javax.lang.model.element.AnnotationValue value)Returns the value as a VariableElement.static int[]getIntArrayValue(javax.lang.model.element.AnnotationMirror annotation, java.lang.String valueName)Returns the int array value of an annotationstatic intgetIntValue(javax.lang.model.element.AnnotationMirror annotation, java.lang.String valueName)Returns the int value of an annotationstatic java.util.Optional<java.lang.Integer>getOptionalIntValue(javax.lang.model.element.AnnotationMirror annotation, java.lang.String valueName)Returns an optional int value of an annotation if the value name is presentstatic java.util.Optional<java.lang.String>getOptionalStringValue(javax.lang.model.element.AnnotationMirror annotation, java.lang.String valueName)Returns an optional String value of an annotation if the value name is presentstatic java.lang.StringgetString(javax.lang.model.element.AnnotationValue value)Returns the value as a string.static java.lang.String[]getStringArrayValue(javax.lang.model.element.AnnotationMirror annotation, java.lang.String valueName)Returns the String array value of an annotationstatic com.google.common.collect.ImmutableSet<java.lang.String>getStrings(javax.lang.model.element.AnnotationValue value)Returns a string array value as a set of strings.static java.lang.StringgetStringValue(javax.lang.model.element.AnnotationMirror annotation, java.lang.String valueName)Returns the String value of an annotationstatic javax.lang.model.element.TypeElementgetTypeElement(javax.lang.model.element.AnnotationValue value)Returns a class value as aTypeElement.static com.google.common.collect.ImmutableSet<javax.lang.model.element.TypeElement>getTypeElements(javax.lang.model.element.AnnotationValue value)Returns a class array value as a set ofTypeElement.static javax.lang.model.type.DeclaredTypegetTypeMirror(javax.lang.model.element.AnnotationValue value)Returns the value as a class.
-
-
-
Method Detail
-
getTypeMirror
public static javax.lang.model.type.DeclaredType getTypeMirror(javax.lang.model.element.AnnotationValue value)
Returns the value as a class.- Throws:
java.lang.IllegalArgumentException- if the value is not a class.
-
getTypeElements
public static com.google.common.collect.ImmutableSet<javax.lang.model.element.TypeElement> getTypeElements(javax.lang.model.element.AnnotationValue value)
Returns a class array value as a set ofTypeElement.
-
getTypeElement
public static javax.lang.model.element.TypeElement getTypeElement(javax.lang.model.element.AnnotationValue value)
Returns a class value as aTypeElement.
-
getEnum
public static javax.lang.model.element.VariableElement getEnum(javax.lang.model.element.AnnotationValue value)
Returns the value as a VariableElement.- Throws:
java.lang.IllegalArgumentException- if the value is not an enum.
-
getStrings
public static com.google.common.collect.ImmutableSet<java.lang.String> getStrings(javax.lang.model.element.AnnotationValue value)
Returns a string array value as a set of strings.
-
getString
public static java.lang.String getString(javax.lang.model.element.AnnotationValue value)
Returns the value as a string.- Throws:
java.lang.IllegalArgumentException- if the value is not a string.
-
getBoolean
public static boolean getBoolean(javax.lang.model.element.AnnotationValue value)
Returns the value as a boolean.- Throws:
java.lang.IllegalArgumentException- if the value is not a boolean.
-
getIntValue
public static int getIntValue(javax.lang.model.element.AnnotationMirror annotation, java.lang.String valueName)Returns the int value of an annotation
-
getOptionalIntValue
public static java.util.Optional<java.lang.Integer> getOptionalIntValue(javax.lang.model.element.AnnotationMirror annotation, java.lang.String valueName)Returns an optional int value of an annotation if the value name is present
-
getStringValue
public static java.lang.String getStringValue(javax.lang.model.element.AnnotationMirror annotation, java.lang.String valueName)Returns the String value of an annotation
-
getOptionalStringValue
public static java.util.Optional<java.lang.String> getOptionalStringValue(javax.lang.model.element.AnnotationMirror annotation, java.lang.String valueName)Returns an optional String value of an annotation if the value name is present
-
getIntArrayValue
public static int[] getIntArrayValue(javax.lang.model.element.AnnotationMirror annotation, java.lang.String valueName)Returns the int array value of an annotation
-
getStringArrayValue
public static java.lang.String[] getStringArrayValue(javax.lang.model.element.AnnotationMirror annotation, java.lang.String valueName)Returns the String array value of an annotation
-
getAnnotationValues
public static com.google.common.collect.ImmutableList<javax.lang.model.element.AnnotationValue> getAnnotationValues(javax.lang.model.element.AnnotationValue annotationValue)
Returns the list of values represented by an array annotation value.- Throws:
java.lang.IllegalArgumentException- unlessannotationValuerepresents an array
-
-