Package org.codehaus.backport175.reader.bytecode

Examples of org.codehaus.backport175.reader.bytecode.AnnotationDefaults$DefaultAnnotationBuilderVisitor


        assertEquals("foo", simple.val());
    }

    public void testMethodAnn7() {
        final AnnotationReader reader = AnnotationReader.getReaderFor(Target.METHOD.getDeclaringClass());
        Annotation annotation = reader.getAnnotation("test.TestAnnotations$NestedAnnotationArray", Target.METHOD);
        Class type = annotation.annotationType();
        assertEquals(TestAnnotations.NestedAnnotationArray.class, type);

        TestAnnotations.NestedAnnotationArray ann = (TestAnnotations.NestedAnnotationArray)annotation;
        TestAnnotations.Simple[] simpleAnnArray = ann.annArr();
        assertEquals("foo", simpleAnnArray[0].val());
View Full Code Here


        assertEquals("bar", simpleAnnArray[1].val());
    }

    public void testMethodAnn8() {
        final AnnotationReader reader = AnnotationReader.getReaderFor(Target.METHOD.getDeclaringClass());
        Annotation annotation = reader.getAnnotation("test.TestAnnotations$Complex", Target.METHOD);
        Class type = annotation.annotationType();
        assertEquals(TestAnnotations.Complex.class, type);

        TestAnnotations.Complex ann = (TestAnnotations.Complex)annotation;
        assertEquals(111, ann.i());
View Full Code Here

        annotations = Annotations.getAnnotations(Target.METHOD);
    }

    public void testReadInResolvedValues() {
        final AnnotationReader reader = AnnotationReader.getReaderFor(Target.METHOD.getDeclaringClass());
        Annotation annotation = reader.getAnnotation("test.TestAnnotations$Complex", Target.METHOD);
        TestAnnotations.Complex ann = (TestAnnotations.Complex)annotation;
        assertEquals(111, ann.i());
        double[] doubleArr = ann.doubleArr();
        assertEquals(1.1D, doubleArr[0], 0);
        assertEquals(2.2D, doubleArr[1], 0);
View Full Code Here

        enumRef = ann.enumeration();
        assertTrue(enumRef.equals(AnnotationElement.Type.ANNOTATION));
    }

    public void testNestedClassAnn() {
        Annotation annotation = Annotations.getAnnotation(Nested.Anno.class, Nested.class);
        assertNotNull(annotation);
        assertEquals("nested", ((Nested.Anno)annotation).value());

        //test enclosing doesn't have it..
        annotation = Annotations.getAnnotation(Nested.Anno.class, AnnotationReaderTest.class);
View Full Code Here

    public PrimitiveTest(String name) {
        super(name);
    }

    public void testLong() {
        Annotation annotation = Annotations.getAnnotation(
                Target.Long.class, Target.class
        );
        assertEquals(Target.Long.class, annotation.annotationType());
        Target.Long ann = (Target.Long)annotation;
        assertEquals(123456789123456789L, ann.v());
        assertEquals(1L, ann.arr()[0]);
        assertEquals(2L, ann.arr()[1]);
        assertEquals(3L, ann.arr()[2]);
View Full Code Here

        assertEquals(3L, ann.arr()[2]);
        assertEquals(4L, ann.arr()[3]);
    }

    public void testInt() {
        Annotation annotation = Annotations.getAnnotation(
                Target.Integer.class, Target.class
        );
        assertEquals(Target.Integer.class, annotation.annotationType());
        Target.Integer ann = (Target.Integer)annotation;
        assertEquals(1, ann.v());
        assertEquals(1, ann.arr()[0]);
        assertEquals(2, ann.arr()[1]);
        assertEquals(3, ann.arr()[2]);
View Full Code Here

        assertEquals(3, ann.arr()[2]);
        assertEquals(4, ann.arr()[3]);
    }

    public void testDouble() {
        Annotation annotation = Annotations.getAnnotation(
                test.primitives.Target.Double.class, Target.class
        );
        assertEquals(Target.Double.class, annotation.annotationType());
        Target.Double ann = (Target.Double)annotation;
        assertEquals(1.123456789123456789D, ann.v(), 0);
        assertEquals(1.0D, ann.arr()[0], 0);
        assertEquals(2.4D, ann.arr()[1], 0);
        assertEquals(3.56D, ann.arr()[2], 0);
View Full Code Here

        assertEquals(3.56D, ann.arr()[2], 0);
        assertEquals(4.0D, ann.arr()[3], 0);
    }

    public void testFloat() {
        Annotation annotation = Annotations.getAnnotation(
                Target.Float.class, Target.class
        );
        assertEquals(Target.Float.class, annotation.annotationType());
        Target.Float ann = (Target.Float)annotation;
        assertEquals(1.0F, ann.v(), 0);
        assertEquals(1.1F, ann.arr()[0], 0);
        assertEquals(2.3455F, ann.arr()[1], 0);
        assertEquals(3.0F, ann.arr()[2], 0);
View Full Code Here

        assertEquals(3.0F, ann.arr()[2], 0);
        assertEquals(4.0F, ann.arr()[3], 0);
    }

    public void testBoolean() {
        Annotation annotation = Annotations.getAnnotation(
                Target.Boolean.class, Target.class
        );
        assertEquals(Target.Boolean.class, annotation.annotationType());
        Target.Boolean ann = (Target.Boolean)annotation;
        assertTrue(ann.v());
        assertTrue(ann.arr()[0]);
        assertFalse(ann.arr()[1]);
        assertTrue(ann.arr()[2]);
View Full Code Here

        assertTrue(ann.arr()[2]);
        assertFalse(ann.arr()[3]);
    }

    public void testChar() {
        Annotation annotation = Annotations.getAnnotation(
                Target.Char.class, Target.class
        );
        assertEquals(Target.Char.class, annotation.annotationType());
        Target.Char ann = (Target.Char)annotation;
        assertEquals('a', ann.v());
        assertEquals('b', ann.arr()[0]);
        assertEquals('C', ann.arr()[1]);
        assertEquals('D', ann.arr()[2]);
View Full Code Here

TOP

Related Classes of org.codehaus.backport175.reader.bytecode.AnnotationDefaults$DefaultAnnotationBuilderVisitor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.