com.openpojo.reflection.filters.FilterChain Java Examples

The following examples show how to use com.openpojo.reflection.filters.FilterChain. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BeanTest.java    From openpojo with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() {
  LogHelper.initializeLoggers();
  PojoClassFilter pojoClassFilter = new FilterChain(new FilterEnum(), new FilterPackageInfo());
  pojoClasses = PojoClassFactory.getPojoClassesRecursively(this.getClass().getPackage().getName() + ".sampleclasses",
      pojoClassFilter);

  ValidatorBuilder validatorBuilder = ValidatorBuilder.create();

  // Create Rules to validate structure for POJO_PACKAGE
  validatorBuilder.with(new NoPublicFieldsRule());
  validatorBuilder.with(new NoStaticExceptFinalRule());
  validatorBuilder.with(new GetterMustExistRule());
  validatorBuilder.with(new SetterMustExistRule());

  // Create Testers to validate behaviour for POJO_PACKAGE
  validatorBuilder.with(new DefaultValuesNullTester());
  validatorBuilder.with(new SetterTester());
  validatorBuilder.with(new GetterTester());

  pojoValidator = validatorBuilder.build();
}
 
Example #2
Source File: DefaultPojoClassLookupService.java    From openpojo with Apache License 2.0 5 votes vote down vote up
public List<PojoClass> enumerateClassesByExtendingType(final String packageName, final Class<?> type,
                                                       final PojoClassFilter pojoClassFilter) {

  final FilterBasedOnInheritance inheritanceFilter = new FilterBasedOnInheritance(type);
  final FilterChain filterChain = new FilterChain(inheritanceFilter, pojoClassFilter);
  return getPojoClassesRecursively(packageName, filterChain);
}
 
Example #3
Source File: CollectionAndMapPackageRandomGeneratorsTest.java    From openpojo with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setup() {
  for (final String pkg : packages) {
    collectionRandomGenerators.addAll(PojoClassFactory.getPojoClassesRecursively(pkg,
        new FilterChain(
            new RandomGeneratorFilter(),
            new FilterNestedClasses(),
            new FilterNonConcrete())));
  }
  Affirm.affirmEquals(MessageFormatter.format("Invalid number of Collection/Map RandomGenerators added/removed? " +
          "expected: " + "[{0}], found: [{1}] which were [{2}] ", EXPECTED_COUNT, collectionRandomGenerators.size(),
      collectionRandomGenerators), EXPECTED_COUNT, collectionRandomGenerators.size());
}
 
Example #4
Source File: DefaultValidator.java    From openpojo with Apache License 2.0 4 votes vote down vote up
public List<PojoClass> validate(String packageName, PojoClassFilter... filters) {
  PojoClassFilter pojoClassFilter = new FilterChain(filters);
  List<PojoClass> pojoClasses = PojoClassFactory.getPojoClasses(packageName, pojoClassFilter);
  validate(pojoClasses);
  return pojoClasses;
}
 
Example #5
Source File: DefaultValidator.java    From openpojo with Apache License 2.0 4 votes vote down vote up
public List<PojoClass> validateRecursively(String packageName, PojoClassFilter... filters) {
  PojoClassFilter pojoClassFilter = new FilterChain(filters);
  List<PojoClass> pojoClasses = PojoClassFactory.getPojoClassesRecursively(packageName, pojoClassFilter);
  validate(pojoClasses);
  return pojoClasses;
}
 
Example #6
Source File: DefaultPojoClassLookupService.java    From openpojo with Apache License 2.0 4 votes vote down vote up
private PojoClassFilter getFinalFilterChain(PojoClassFilter pojoClassFilter) {
  return new FilterChain(pojoClassFilter, ServiceRegistrar.getInstance().getPojoCoverageFilterService());
}