Package org.codehaus.backport175.reader

Examples of org.codehaus.backport175.reader.Annotation


    public Annotation getAnnotation(final String annotationName) {
        Object cachedAnnotation = m_classAnnotationCache.get(annotationName);
        if (cachedAnnotation != null) {
            return (Annotation) cachedAnnotation;
        } else {
            final Annotation annotation;
            final AnnotationElement.Annotation annotationInfo =
                    (AnnotationElement.Annotation) m_classAnnotationElements.get(annotationName);
            if (annotationInfo != null) {
                annotation = ProxyFactory.newAnnotationProxy(annotationInfo, m_classKey.getClassLoader());
                m_classAnnotationCache.put(annotationName, annotation);
View Full Code Here


        assertNull(annotation);
    }

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

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

            // no such annotation
            return null;
        }
        Object annotationElement = annotations.get(annotationName);
        if (annotationElement != null) {
            Annotation annotation = ProxyFactory.newAnnotationProxy(
                    (AnnotationElement.Annotation) annotationElement,
                    loader
            );
            annotationMap.put(annotationName, annotation);
            return annotation;
View Full Code Here

        assertEquals(String[][].class, ann.type());
    }

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

        TestAnnotations.NestedAnnotation ann = (TestAnnotations.NestedAnnotation)annotation;
        TestAnnotations.Simple simple = ann.ann();
        assertEquals("foo", simple.val());
View Full Code Here

            // no such annotation
            return null;
        }
        Object annotationElement = annotations.get(annotationName);
        if (annotationElement != null) {
            Annotation annotation = ProxyFactory.newAnnotationProxy(
                    (AnnotationElement.Annotation) annotationElement,
                    loader
            );
            annotationMap.put(annotationName, annotation);
            return annotation;
View Full Code Here

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

    public void testClassAnn8() {
        final AnnotationReader reader = AnnotationReader.getReaderFor(Target.class);
        Annotation annotation = reader.getAnnotation("test.TestAnnotations$NestedAnnotationArray");
        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

            // no such annotation
            return null;
        }
        Object annotationElement = annotations.get(annotationName);
        if (annotationElement != null) {
            Annotation annotation = ProxyFactory.newAnnotationProxy(
                    (AnnotationElement.Annotation) annotationElement,
                    loader
            );
            annotationMap.put(annotationName, annotation);
            return annotation;
View Full Code Here

        assertFalse(Annotations.isAnnotationPresent(Target.class, Target.FIELD));
    }

    public void testFieldAnn1() {
        final AnnotationReader reader = AnnotationReader.getReaderFor(Target.FIELD.getDeclaringClass());
        Annotation annotation = reader.getAnnotation("test.TestAnnotations$VoidTyped", Target.FIELD);
        Class type = annotation.annotationType();
        assertEquals(TestAnnotations.VoidTyped.class, type);
    }
View Full Code Here

        assertEquals(TestAnnotations.VoidTyped.class, type);
    }

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

        TestAnnotations.DefaultString ann = (TestAnnotations.DefaultString)annotation;
        assertEquals("hello", ann.value());
    }
View Full Code Here

        assertEquals("hello", ann.value());
    }

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

        TestAnnotations.Simple ann = (TestAnnotations.Simple)annotation;
        assertEquals("foo", ann.val());
        assertEquals("bar", ann.s());
View Full Code Here

TOP

Related Classes of org.codehaus.backport175.reader.Annotation

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.