本文整理汇总了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);
}