本文整理匯總了Java中org.ofbiz.entity.condition.EntityCondition.entityMatches方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityCondition.entityMatches方法的具體用法?Java EntityCondition.entityMatches怎麽用?Java EntityCondition.entityMatches使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.ofbiz.entity.condition.EntityCondition
的用法示例。
在下文中一共展示了EntityCondition.entityMatches方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: filterByAnd
import org.ofbiz.entity.condition.EntityCondition; //導入方法依賴的package包/類
/**
*returns the values that match all of the exprs in list
*
*@param values List of GenericValues
*@param exprs the expressions that must validate to true
*@return List of GenericValue's that match the values in fields
*/
public static <T extends GenericEntity> List<T> filterByAnd(List<T> values, List<? extends EntityCondition> exprs) {
if (values == null) return null;
if (UtilValidate.isEmpty(exprs)) {
// no constraints... oh well
return values;
}
List<T> result = new LinkedList<T>();
for (T value: values) {
boolean include = true;
for (EntityCondition condition: exprs) {
include = condition.entityMatches(value);
if (!include) break;
}
if (include) {
result.add(value);
}
}
return result;
}
示例2: filterByOr
import org.ofbiz.entity.condition.EntityCondition; //導入方法依賴的package包/類
/**
*returns the values that match any of the exprs in list
*
*@param values List of GenericValues
*@param exprs the expressions that must validate to true
*@return List of GenericValue's that match the values in fields
*/
public static <T extends GenericEntity> List<T> filterByOr(List<T> values, List<? extends EntityCondition> exprs) {
if (values == null) return null;
if (UtilValidate.isEmpty(exprs)) {
return values;
}
List<T> result = new LinkedList<T>();
for (T value: values) {
boolean include = false;
for (EntityCondition condition: exprs) {
include = condition.entityMatches(value);
if (include) break;
}
if (include) {
result.add(value);
}
}
return result;
}
示例3: remove
import org.ofbiz.entity.condition.EntityCondition; //導入方法依賴的package包/類
public void remove(String entityName, EntityCondition condition) {
UtilCache<GenericPK, GenericValue> entityCache = getCache(entityName);
if (entityCache == null) return;
for (GenericPK pk: entityCache.getCacheLineKeys()) {
GenericValue entity = entityCache.get(pk);
if (entity == null) continue;
if (condition.entityMatches(entity)) entityCache.remove(pk);
}
}
示例4: filterByCondition
import org.ofbiz.entity.condition.EntityCondition; //導入方法依賴的package包/類
public static <T extends GenericEntity> List<T> filterByCondition(List<T> values, EntityCondition condition) {
if (values == null) return null;
List<T> result = new LinkedList<T>();
for (T value: values) {
if (condition.entityMatches(value)) {
result.add(value);
}
}
return result;
}
示例5: filterOutByCondition
import org.ofbiz.entity.condition.EntityCondition; //導入方法依賴的package包/類
public static <T extends GenericEntity> List<T> filterOutByCondition(List<T> values, EntityCondition condition) {
if (values == null) return null;
List<T> result = new LinkedList<T>();
for (T value: values) {
if (!condition.entityMatches(value)) {
result.add(value);
}
}
return result;
}
示例6: matches
import org.ofbiz.entity.condition.EntityCondition; //導入方法依賴的package包/類
public boolean matches(EntityCondition condition) {
return condition.entityMatches(this);
}