当前位置: 首页>>代码示例>>Java>>正文


Java PojoField类代码示例

本文整理汇总了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();
}
 
开发者ID:streamingpool,项目名称:streamingpool-core,代码行数:14,代码来源:PojoClassFilters.java

示例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());
}
 
开发者ID:streamingpool,项目名称:streamingpool-core,代码行数:15,代码来源:PojoClassFilters.java


注:本文中的com.openpojo.reflection.PojoField类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。