use of org.reflections.util.FilterBuilder in project reflections by ronmamo.
the class FilterBuilderTest method test_parse_include_exclude.
@Test
public void test_parse_include_exclude() {
FilterBuilder filter = FilterBuilder.parse("+org.reflections.*, -org.reflections.foo.*");
assertTrue(filter.apply("org.reflections.Reflections"));
assertFalse(filter.apply("org.reflections.foo.Reflections"));
assertFalse(filter.apply("org.foobar.Reflections"));
}
use of org.reflections.util.FilterBuilder in project reflections by ronmamo.
the class JavaCodeSerializerTest method generateAndSave.
@BeforeClass
public static void generateAndSave() {
Predicate<String> filter = new FilterBuilder().include("org.reflections.TestModel\\$.*");
Reflections reflections = new Reflections(new ConfigurationBuilder().filterInputsBy(filter).setScanners(new TypeElementsScanner().includeFields().publicOnly(false)).setUrls(asList(ClasspathHelper.forClass(TestModel.class))));
//save
String filename = ReflectionsTest.getUserDir() + "/src/test/java/org.reflections.MyTestModelStore";
reflections.save(filename, new JavaCodeSerializer());
}
use of org.reflections.util.FilterBuilder 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));
}
Aggregations