Package org.apache.felix.ipojo.manipulator.metadata

Examples of org.apache.felix.ipojo.manipulator.metadata.AnnotationMetadataProvider


        //1.1 Metadata collection
        byte[] origin = ManipulatorTest.getBytesFromFile(new File("target/test-classes/test/PlentyOfAnnotations.class"));
        MiniStore store = new MiniStore()
                .addClassToStore("test.PlentyOfAnnotations",
                        origin);
        AnnotationMetadataProvider provider = new AnnotationMetadataProvider(store, reporter);
        List<Element> originalMetadata = provider.getMetadatas();
        // 1.2 Manipulation
        Manipulator manipulator = new Manipulator(this.getClass().getClassLoader());
        manipulator.prepare(origin);
        byte[] clazz = manipulator.manipulate(origin);
        Element originalManipulationMetadata = manipulator.getManipulationMetadata();
        // 1.3 Check that the class is valid
        ManipulatedClassLoader classloader = new ManipulatedClassLoader("test.PlentyOfAnnotations", clazz);
        Class cl = classloader.findClass("test.PlentyOfAnnotations");
        Assert.assertNotNull(cl);

        // ---------------

        // Step 2 - Second collection and manipulation
        // We use the output class as entry.
        // 2.1 Metadata collection
        store = new MiniStore().addClassToStore("test.PlentyOfAnnotations", clazz);
        provider = new AnnotationMetadataProvider(store, reporter);
        List<Element> metadataAfterOneManipulation = provider.getMetadatas();
        // 2.2 Manipulation
        manipulator = new Manipulator(this.getClass().getClassLoader());
        manipulator.prepare(clazz);
        byte[] clazz2 = manipulator.manipulate(clazz);
        Element manipulationMetadataAfterSecondManipulation = manipulator.getManipulationMetadata();
        // 2.3 Check that the class is valid
        classloader = new ManipulatedClassLoader("test.PlentyOfAnnotations", clazz);
        cl = classloader.findClass("test.PlentyOfAnnotations");
        Assert.assertNotNull(cl);

        // ---------------

        // Step 3 - Third collection and manipulation
        // We use the output class of 2 as entry.
        // 3.1 Metadata collection
        store = new MiniStore().addClassToStore("test.PlentyOfAnnotations", clazz2);
        provider = new AnnotationMetadataProvider(store, reporter);
        List<Element> metadataAfterTwoManipulation = provider.getMetadatas();
        // 3.2 Manipulation
        manipulator = new Manipulator(this.getClass().getClassLoader());
        manipulator.prepare(clazz2);
        byte[] clazz3 = manipulator.manipulate(clazz2);
        Element manipulationMetadataAfterThirdManipulation = manipulator.getManipulationMetadata();
View Full Code Here


                ResourceMetadataProvider rmp = new ResourceMetadataProvider(resource, reporter);
                rmp.setValidateUsingLocalSchemas(m_useLocalSchemas);
                provider.addMetadataProvider(rmp);
            }
        }
        provider.addMetadataProvider(new AnnotationMetadataProvider(store, reporter));
        return provider;
    }
View Full Code Here

TOP

Related Classes of org.apache.felix.ipojo.manipulator.metadata.AnnotationMetadataProvider

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.