當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。