Search in sources :

Example 56 with AnnotationValue

use of javax.lang.model.element.AnnotationValue in project auto by google.

the class AnnotationValuesTest method getFloats.

@Test
public void getFloats() {
    AnnotationValue value = AnnotationMirrors.getAnnotationValue(annotationMirror, "floatValues");
    assertThat(AnnotationValues.getFloats(value)).containsExactly(14F, 15F).inOrder();
}
Also used : AnnotationValue(javax.lang.model.element.AnnotationValue) Test(org.junit.Test)

Example 57 with AnnotationValue

use of javax.lang.model.element.AnnotationValue in project auto by google.

the class AnnotationValuesTest method getStrings.

@Test
public void getStrings() {
    AnnotationValue value = AnnotationMirrors.getAnnotationValue(annotationMirror, "stringValues");
    assertThat(AnnotationValues.getStrings(value)).containsExactly("it's", "me").inOrder();
}
Also used : AnnotationValue(javax.lang.model.element.AnnotationValue) Test(org.junit.Test)

Example 58 with AnnotationValue

use of javax.lang.model.element.AnnotationValue in project auto by google.

the class AnnotationValuesTest method getBooleans.

@Test
public void getBooleans() {
    AnnotationValue value = AnnotationMirrors.getAnnotationValue(annotationMirror, "booleanValues");
    assertThat(AnnotationValues.getBooleans(value)).containsExactly(true, false).inOrder();
}
Also used : AnnotationValue(javax.lang.model.element.AnnotationValue) Test(org.junit.Test)

Example 59 with AnnotationValue

use of javax.lang.model.element.AnnotationValue in project auto by google.

the class AnnotationValuesTest method getTypeMirrorGenericClass.

@Test
public void getTypeMirrorGenericClass() {
    TypeElement genericClass = getTypeElement(GenericClass.class);
    AnnotationValue gvalue = AnnotationMirrors.getAnnotationValue(annotationMirror, "genericClassValue");
    assertThat(AnnotationValues.getTypeMirror(gvalue).asElement()).isEqualTo(genericClass);
}
Also used : TypeElement(javax.lang.model.element.TypeElement) AnnotationValue(javax.lang.model.element.AnnotationValue) Test(org.junit.Test)

Example 60 with AnnotationValue

use of javax.lang.model.element.AnnotationValue in project auto by google.

the class AnnotationValuesTest method getChars.

@Test
public void getChars() {
    AnnotationValue value = AnnotationMirrors.getAnnotationValue(annotationMirror, "charValues");
    assertThat(AnnotationValues.getChars(value)).containsExactly('b', 'c').inOrder();
}
Also used : AnnotationValue(javax.lang.model.element.AnnotationValue) Test(org.junit.Test)

Aggregations

AnnotationValue (javax.lang.model.element.AnnotationValue)182 AnnotationMirror (javax.lang.model.element.AnnotationMirror)81 TypeElement (javax.lang.model.element.TypeElement)62 ArrayList (java.util.ArrayList)54 ExecutableElement (javax.lang.model.element.ExecutableElement)53 TypeMirror (javax.lang.model.type.TypeMirror)48 List (java.util.List)45 Test (org.junit.Test)30 DeclaredType (javax.lang.model.type.DeclaredType)27 Map (java.util.Map)20 HashSet (java.util.HashSet)19 HashMap (java.util.HashMap)18 VariableElement (javax.lang.model.element.VariableElement)15 Element (javax.lang.model.element.Element)14 ElementUtils.getAnnotationValue (com.oracle.truffle.dsl.processor.java.ElementUtils.getAnnotationValue)10 ElementUtils.fromTypeMirror (com.oracle.truffle.dsl.processor.java.ElementUtils.fromTypeMirror)9 CodeExecutableElement (com.oracle.truffle.dsl.processor.java.model.CodeExecutableElement)8 ElementUtils.resolveAnnotationValue (com.oracle.truffle.dsl.processor.java.ElementUtils.resolveAnnotationValue)7 ElementUtils.unboxAnnotationValue (com.oracle.truffle.dsl.processor.java.ElementUtils.unboxAnnotationValue)7 ArrayCodeTypeMirror (com.oracle.truffle.dsl.processor.java.model.CodeTypeMirror.ArrayCodeTypeMirror)7