本文整理汇总了Java中com.openpojo.reflection.PojoField类的典型用法代码示例。如果您正苦于以下问题:Java PojoField类的具体用法?Java PojoField怎么用?Java PojoField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PojoField类属于com.openpojo.reflection包,在下文中一共展示了PojoField类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: include
import com.openpojo.reflection.PojoField; //导入依赖的package包/类
@Override
public boolean include(PojoClass pojoClass) {
List<PojoField> pojoFields = pojoClass.getPojoFields();
List<PojoField> filtered = new ArrayList<>();
for (PojoField pojoField : pojoFields) {
boolean isConstant = pojoField.isStatic() && pojoField.isFinal();
boolean isJaCoCoAddedField = isJaCoCoAddedField(pojoField);
if (!(isConstant || isJaCoCoAddedField)) {
filtered.add(pojoField);
}
}
return !filtered.isEmpty();
}
示例2: isJaCoCoAddedField
import com.openpojo.reflection.PojoField; //导入依赖的package包/类
/**
* JaCoCo coverage calculation tool adds one specific field '$jacocoData' to every tested object. As here we are
* generating test cases based on the field existing in the Class, we need to exclude this additional field.
* <br/>
* Official JaCoCo documentation (take a look at 'My code uses reflection. Why does it fail when I execute it
* with JaCoCo?'): http://www.eclemma.org/jacoco/trunk/doc/faq.html<br/>
* JaCoCo marks this additional field as 'synthetic'. Theoretically, we should be able to exclude it checking
* access modifiers, but PojoField class does not allow to access Field nor exposes any way to check the
* synthetic modifier (newer version version of openpojo library expose this possibility so that after upgrading
* we can replace this method with simply 'pojoField.isSynthetic()').
*/
private boolean isJaCoCoAddedField(PojoField pojoField) {
return "$jacocoData".equals(pojoField.getName());
}