本文整理汇总了Java中com.openpojo.reflection.PojoClassFilter类的典型用法代码示例。如果您正苦于以下问题:Java PojoClassFilter类的具体用法?Java PojoClassFilter怎么用?Java PojoClassFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PojoClassFilter类属于com.openpojo.reflection包,在下文中一共展示了PojoClassFilter类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import com.openpojo.reflection.PojoClassFilter; //导入依赖的package包/类
@Before
public void setup() {
pojoClasses = PojoClassFactory.getPojoClassesRecursively(POJO_PACKAGE, new PojoClassFilter() {
@Override
public boolean include(PojoClass pojoClass) {
if(pojoClass.getName().contains("abstract")) {
return false;
}
if(!pojoClass.getName().contains("pocketmedia")) {
return false;
}
return true;
}
});
pojoValidator = new PojoValidator();
// Create Testers to validate behavior for POJO_PACKAGE
pojoValidator.addTester(new SetterTester());
pojoValidator.addTester(new GetterTester());
}
示例2: setup
import com.openpojo.reflection.PojoClassFilter; //导入依赖的package包/类
@BeforeTest
public void setup() {
this.pojoClasses = PojoClassFactory.getPojoClasses(POJO_PACKAGE, new PojoClassFilter() {
@Override
public boolean include(final PojoClass pojoClass) {
System.out.println(pojoClass.getName());
return pojoClass.getName().endsWith("Style");
}
});
this.pojoValidator = new PojoValidator();
// Create Testers to validate behavior for POJO_PACKAGE
this.pojoValidator.addTester(new SetterTester());
this.pojoValidator.addTester(new GetterTester());
}
示例3: exclude
import com.openpojo.reflection.PojoClassFilter; //导入依赖的package包/类
public final static PojoClassFilter exclude(Class<?>... classesToExclude) {
return new ExcludeClassesFilter(classesToExclude);
}
示例4: excludeBySimpleName
import com.openpojo.reflection.PojoClassFilter; //导入依赖的package包/类
public final static PojoClassFilter excludeBySimpleName(String... simpleNamesToExclude) {
return new ExcludeClassNameFilter(simpleNamesToExclude);
}
示例5: includeTypes
import com.openpojo.reflection.PojoClassFilter; //导入依赖的package包/类
public final static PojoClassFilter includeTypes(Class<?>... classesToInclude) {
return new IncludeOnlyTypesFilter(classesToInclude);
}
示例6: excludeTestClasses
import com.openpojo.reflection.PojoClassFilter; //导入依赖的package包/类
public final static PojoClassFilter excludeTestClasses() {
return new ExcludeTestClassesFilter();
}
示例7: excludeNonConcrete
import com.openpojo.reflection.PojoClassFilter; //导入依赖的package包/类
public final static PojoClassFilter excludeNonConcrete() {
return new FilterNonConcrete();
}
示例8: excludeNestedClasses
import com.openpojo.reflection.PojoClassFilter; //导入依赖的package包/类
public final static PojoClassFilter excludeNestedClasses() {
return new FilterNestedClasses();
}
示例9: hasFields
import com.openpojo.reflection.PojoClassFilter; //导入依赖的package包/类
public static final PojoClassFilter hasFields() {
return new ClassHasFieldsFilter();
}
示例10: excludeInheritingFrom
import com.openpojo.reflection.PojoClassFilter; //导入依赖的package包/类
public static final PojoClassFilter excludeInheritingFrom(Class<?>... classesToExclude) {
return new ExcludeInheritingFromFilter(classesToExclude);
}
示例11: excludeEnums
import com.openpojo.reflection.PojoClassFilter; //导入依赖的package包/类
public static final PojoClassFilter excludeEnums() {
return excludeInheritingFrom(Enum.class);
}
示例12: excludeInterfaces
import com.openpojo.reflection.PojoClassFilter; //导入依赖的package包/类
public static final PojoClassFilter excludeInterfaces() {
return new ExcludeInterfacesFilter();
}
示例13: pojocClassesForPackageName
import com.openpojo.reflection.PojoClassFilter; //导入依赖的package包/类
/**
* creates parameters which are conform with a {@link AbstractPojoTest}, taking classes from below the given package
* name and taking into account the given filters. The following filters are applied by default:
* <ul>
* <li>{@link FilterPackageInfo}: Ignores the package-info.java
* <li>{@link ExcludeTestClassesFilter}: Ignores test classes
* <li>{@link FilterCloverClasses}: Ignores all classes generated by clover instrumentation
* <li>{@link FilterNestedClasses}: Ignores all nested classes
* </ul>
*
* @param packageName the package name, from which to start searching for classes
* @param classFilters the filters for the classes which will be used
* @return a list of objects, which will represent a parameter array of className - class pairs. These can be
* directly used in a test which extends {@link AbstractPojoTest}.
*/
public static List<Class<?>> pojocClassesForPackageName(String packageName, PojoClassFilter... classFilters) {
List<PojoClassFilter> filters = new ArrayList<>();
filters.addAll(Arrays.asList(
new PojoClassFilter[] { new FilterPackageInfo(), excludeTestClasses(), new FilterCloverClasses() }));
filters.addAll(Arrays.asList(classFilters));
List<PojoClass> pojoClasses = PojoClassFactory.getPojoClassesRecursively(packageName,
new FilterChain(filters.toArray(new PojoClassFilter[] {})));
return pojoClasses.stream().map(pc -> pc.getClazz()).collect(toList());
}
示例14: pojoClassesForPackageNames
import com.openpojo.reflection.PojoClassFilter; //导入依赖的package包/类
/**
* creates parameters which are conform with a {@link AbstractPojoTest}, taking classes from below all given package
* names and taking into account the given filters. This is a convenience method for calling
* {@link #pojocClassesForPackageName(String, PojoClassFilter...)} with many package names.
*
* @param packageNames the package names which shall be searched recursively for classes
* @param classFilters the filters which shall be applied to the found classes
* @return a list of objects, which will represent an array of parameters for the {@link AbstractPojoTest}. (Pairs
* of className + class)
* @see #pojocClassesForPackageName(String, PojoClassFilter...)
*/
public static List<Class<?>> pojoClassesForPackageNames(String[] packageNames, PojoClassFilter... classFilters) {
List<Class<?>> parameters = new ArrayList<>();
for (String packageName : packageNames) {
parameters.addAll(pojocClassesForPackageName(packageName, classFilters));
}
System.out.println("Found " + parameters.size() + " matching classes.");
return parameters;
}