List of usage examples for org.apache.commons.collections Predicate getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:edu.uci.ics.jung.graph.impl.AbstractArchetypeGraph.java
protected void checkConstraints(Object o, Collection c) { for (Iterator iter = c.iterator(); iter.hasNext();) { Predicate p = (Predicate) iter.next(); if (!p.evaluate(o)) { throw new ConstraintViolationException( "Predicate " + p.getClass().getName() + " rejected " + o + ": " + p, p); }/* ww w. j a v a 2s . co m*/ } }
From source file:org.sakaiproject.conditions.impl.ResourceReleaseRule.java
public void toXml(Element el) { el.setAttribute("resourceId", this.resourceId); if (this.conj == Rule.Conjunction.OR) { el.setAttribute("conjunction", "OR"); } else if (this.conj == Rule.Conjunction.AND) { el.setAttribute("conjunction", "AND"); }//w w w . jav a2s . com Element predicates = el.getOwnerDocument().createElement("predicates"); el.appendChild(predicates); for (Predicate p : this.predicates) { Element predicateElement = el.getOwnerDocument().createElement("predicate"); predicateElement.setAttribute("class", p.getClass().getName()); predicateElement.setAttribute("receiver", ((BooleanExpression) p).getReceiver()); predicateElement.setAttribute("method", ((BooleanExpression) p).getMethod()); predicateElement.setAttribute("operator", ((BooleanExpression) p).getOperator()); Object argument = ((BooleanExpression) p).getArgument(); if (argument == null) { argument = ""; } predicateElement.setAttribute("argument", argument.toString()); predicates.appendChild(predicateElement); } }