Search in sources :

Example 1 with MatchesFunction

use of net.sourceforge.pmd.lang.xpath.MatchesFunction in project pmd by pmd.

the class MatchesFunctionTest method tryRegexp.

private Object tryRegexp(MyNode myNode, String exp) throws FunctionCallException, NoSuchMethodException {
    MatchesFunction function = new MatchesFunction();
    List<Object> list = new ArrayList<>();
    List<Attribute> attrs = new ArrayList<>();
    attrs.add(new Attribute(myNode, "matches", myNode.getClass().getMethod("getClassName", new Class[0])));
    list.add(attrs);
    list.add(exp);
    Context c = new Context(null);
    c.setNodeSet(new ArrayList<>());
    return function.call(c, list);
}
Also used : Context(org.jaxen.Context) Attribute(net.sourceforge.pmd.lang.ast.xpath.Attribute) ArrayList(java.util.ArrayList) MatchesFunction(net.sourceforge.pmd.lang.xpath.MatchesFunction)

Aggregations

ArrayList (java.util.ArrayList)1 Attribute (net.sourceforge.pmd.lang.ast.xpath.Attribute)1 MatchesFunction (net.sourceforge.pmd.lang.xpath.MatchesFunction)1 Context (org.jaxen.Context)1