PropertyFilter implements Predicate<String> { @Override public boolean test(String propertyName) { return predicate.test(propertyName); } PropertyFilter(Predicate<String> predicate);  PropertyFilter(PropertyFilter outerFilter, String scopeName,
            Predicate<String> predicate);  PropertyFilter(PropertyFilter outerFilter, String scopeName); private  PropertyFilter(String prefix, Predicate<String> predicate); @Override boolean test(String propertyName); String getPrefix(); static final PropertyFilter ACCEPT_ALL; }
@Test public void simpleFilter() { PropertyFilter filter = new PropertyFilter("accept"::equals); Assert.assertTrue(filter.test("accept")); Assert.assertFalse(filter.test("reject")); }
@Test public void filterWithAdditionalLevel() { PropertyFilter outerFilter = new PropertyFilter( name -> !"middle.inner.foo".equals(name)); PropertyFilter middleFilter = new PropertyFilter(outerFilter, "middle", name -> !"inner.bar".equals(name)); PropertyFilter innerFilter = new PropertyFilter(middleFilter, "inner", name -> !"baz".equals(name)); Assert.assertFalse(innerFilter.test("foo")); Assert.assertFalse(innerFilter.test("bar")); Assert.assertFalse(innerFilter.test("baz")); Assert.assertTrue(innerFilter.test("foobar")); }