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


Java PredicateUtils.allPredicate方法代码示例

本文整理汇总了Java中org.apache.commons.collections.PredicateUtils.allPredicate方法的典型用法代码示例。如果您正苦于以下问题:Java PredicateUtils.allPredicate方法的具体用法?Java PredicateUtils.allPredicate怎么用?Java PredicateUtils.allPredicate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.collections.PredicateUtils的用法示例。


在下文中一共展示了PredicateUtils.allPredicate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPredicate

import org.apache.commons.collections.PredicateUtils; //导入方法依赖的package包/类
private Predicate getPredicate(ExtendedProperties properties, List<Predicate> predicates, String keyPreffix) {
    String key = keyPreffix + ".predicate.join";
    String operator = properties.getString(key, "all");
    String[] operators = new String[]{"all", "any", "none", "one"};
    int i = ArrayUtils.indexOf(operators, operator.toLowerCase());
    switch (i) {
        case 1:
            return PredicateUtils.anyPredicate(predicates);
        case 2:
            return PredicateUtils.nonePredicate(predicates);
        case 3:
            return PredicateUtils.onePredicate(predicates);
        default:
            return PredicateUtils.allPredicate(predicates);
    }
}
 
开发者ID:proyecto-adalid,项目名称:adalid,代码行数:17,代码来源:Writer.java

示例2: searchList

import org.apache.commons.collections.PredicateUtils; //导入方法依赖的package包/类
/**
 * A naive "search" that lists the objects, then filters them.
 * This is not an efficient search technique and should be avoided 
 * in favor of the solr-base search method
 * @deprecated
 */
private String searchList(String query) throws Exception {
	
	JSONObject results = new JSONObject();
	
	String annotationsContent = this.index();
	JSONArray annotations = (JSONArray) JSONValue.parse(annotationsContent);
	
	Collection<Predicate> predicates = new ArrayList<Predicate>();
	List<NameValuePair> criteria = URLEncodedUtils.parse(query, Charset.forName(DEFAULT_ENCODING));
	for (NameValuePair pair: criteria) {
		if (pair.getName().equals("limit") || pair.getName().equals("offset")) {
			continue;
		}
		// otherwise add the criteria
		predicates.add(new AnnotationPredicate(pair.getName(), pair.getValue()));
		
	}
	Predicate allPredicate = PredicateUtils.allPredicate(predicates);
	CollectionUtils.filter(annotations, allPredicate);
	
	results.put("total", annotations.size());
	results.put("rows", annotations);
	
	return results.toJSONString();
}
 
开发者ID:DataONEorg,项目名称:annotator,代码行数:32,代码来源:JsonAnnotatorStore.java

示例3: allFilter

import org.apache.commons.collections.PredicateUtils; //导入方法依赖的package包/类
public static <T> Collection<T> allFilter(Collection<T> collection, Predicate... predicates) {
        if (collection == null || collection.isEmpty() || predicates == null) {
            return collection;
        } else {
//          Collection<T> list = new ArrayList<T>();
//          list.addAll(collection);
            Collection<T> list = new ArrayList<>(collection);
            Predicate predicate = PredicateUtils.allPredicate(predicates);
            CollectionUtils.filter(list, predicate);
            return list;
        }
    }
 
开发者ID:proyecto-adalid,项目名称:adalid,代码行数:13,代码来源:ColUtils.java

示例4: getPredicateFromSearchFilter

import org.apache.commons.collections.PredicateUtils; //导入方法依赖的package包/类
public static Predicate getPredicateFromSearchFilter(SearchFilter searchFilter) {
    List<Predicate> predicates = new ArrayList<>();

    final String type         = searchFilter.getParam(SearchFilter.PARAM_TYPE);
    final String name         = searchFilter.getParam(SearchFilter.PARAM_NAME);
    final String supertype    = searchFilter.getParam(SearchFilter.PARAM_SUPERTYPE);
    final String notSupertype = searchFilter.getParam(SearchFilter.PARAM_NOT_SUPERTYPE);

    // Add filter for the type/category
    if (StringUtils.isNotBlank(type)) {
        predicates.add(getTypePredicate(type));
    }

    // Add filter for the name
    if (StringUtils.isNotBlank(name)) {
        predicates.add(getNamePredicate(name));
    }

    // Add filter for the supertype
    if (StringUtils.isNotBlank(supertype)) {
        predicates.add(getSuperTypePredicate(supertype));
    }

    // Add filter for the supertype negation
    if (StringUtils.isNotBlank(notSupertype)) {
        predicates.add(new NotPredicate(getSuperTypePredicate(notSupertype)));
    }

    return PredicateUtils.allPredicate(predicates);
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:31,代码来源:FilterUtil.java

示例5: evaluate

import org.apache.commons.collections.PredicateUtils; //导入方法依赖的package包/类
public boolean evaluate(Object arg0) {
	Predicate judgement = new NullPredicate();
	if (predicates.size() == 1) {
		judgement = predicates.get(0);
	} else {
		if (conj == Conjunction.AND) {
			judgement = PredicateUtils.allPredicate(predicates);
		}
		else if (conj == Conjunction.OR) {
			judgement = PredicateUtils.anyPredicate(predicates);
		}
	}
	
	return judgement.evaluate(arg0);
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:16,代码来源:BaseRule.java

示例6: and

import org.apache.commons.collections.PredicateUtils; //导入方法依赖的package包/类
/**
 * 
 * @param predicates
 * @return 
 */
public static Predicate and(Predicate... predicates){
	Assert.notNull(predicates);
	
	return PredicateUtils.allPredicate(predicates);
}
 
开发者ID:ivarptr,项目名称:clobaframe,代码行数:11,代码来源:PredicateFactory.java


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