Example usage for org.apache.commons.collections.functors InstanceofPredicate getInstance

List of usage examples for org.apache.commons.collections.functors InstanceofPredicate getInstance

Introduction

In this page you can find the example usage for org.apache.commons.collections.functors InstanceofPredicate getInstance.

Prototype

public static Predicate getInstance(Class type) 

Source Link

Document

Factory to create the identity predicate.

Usage

From source file:com.tacitknowledge.flip.AbstractFeatureServiceFactory.java

/**
 * Determines whether provided <code>list</code> contains item 
 * of a given type <code>klass</code>
 * //  w  ww.  j  av  a  2 s . c om
 * @param list {@link List} to process
 * @param klass item type to look for
 * @return <code>true</code> in case there is an existent item of a given type within
 *  provided list, <code>false</code> - otherwise
 */
protected boolean isListHasItemOfType(final List<?> list, final Class<?> klass) {
    return CollectionUtils.exists(list, InstanceofPredicate.getInstance(klass));
}

From source file:org.sipfoundry.sipxconfig.admin.dialplan.DialPlan.java

/**
 * This function return all attendant rules contained in this plan.
 *
 * @return list of attendant rules, empty list if no attendant rules in this plan
 *//* w  ww.j a  v  a2 s. c  o m*/
public List<AttendantRule> getAttendantRules() {
    List<AttendantRule> attendantRules = new ArrayList<AttendantRule>();
    Predicate isAttendantRule = InstanceofPredicate.getInstance(AttendantRule.class);
    CollectionUtils.select(m_rules, isAttendantRule, attendantRules);
    return attendantRules;
}