Search in sources :

Example 1 with JsonSerializer

use of org.reflections.serializers.JsonSerializer in project reflections by ronmamo.

the class ReflectionsCollectTest method init.

@BeforeClass
public static void init() {
    Reflections ref = new Reflections(new ConfigurationBuilder().addUrls(ClasspathHelper.forClass(TestModel.class)).filterInputsBy(TestModelFilter).setScanners(new SubTypesScanner(false), new TypeAnnotationsScanner(), new MethodAnnotationsScanner(), new MethodParameterNamesScanner(), new MemberUsageScanner()));
    ref.save(getUserDir() + "/target/test-classes" + "/META-INF/reflections/testModel-reflections.xml");
    ref = new Reflections(new ConfigurationBuilder().setUrls(asList(ClasspathHelper.forClass(TestModel.class))).filterInputsBy(TestModelFilter).setScanners(new MethodParameterScanner()));
    final JsonSerializer serializer = new JsonSerializer();
    ref.save(getUserDir() + "/target/test-classes" + "/META-INF/reflections/testModel-reflections.json", serializer);
    reflections = Reflections.collect().merge(Reflections.collect("META-INF/reflections", new FilterBuilder().include(".*-reflections.json"), serializer));
}
Also used : ConfigurationBuilder(org.reflections.util.ConfigurationBuilder) FilterBuilder(org.reflections.util.FilterBuilder) JsonSerializer(org.reflections.serializers.JsonSerializer) BeforeClass(org.junit.BeforeClass)

Aggregations

BeforeClass (org.junit.BeforeClass)1 JsonSerializer (org.reflections.serializers.JsonSerializer)1 ConfigurationBuilder (org.reflections.util.ConfigurationBuilder)1 FilterBuilder (org.reflections.util.FilterBuilder)1