private RE buildPattern(Element root, String elementName) throws ClassNotFoundException { Node node = root.getElementsByTagName(elementName).item(0);  String pattern = "\\b9876546321\\b"; if (node != null) { pattern = this.buildPattern((Element) node); }  log.debug("Pattern compiled: " + pattern); return new RE(pattern); }
private String buildPattern(Element element) throws ClassNotFoundException { NodeList list = element.getElementsByTagName("class"); StringBuffer buffer = new StringBuffer(); int n = list.getLength(); for (int i = 0; i < n; i++) { Element classElement = (Element) list.item(i); Class clazz = this.buildClass(classElement); Method[] ms = clazz.getMethods(); int m = ms.length; if (m == 0) { buffer.append("\\b"); buffer.append(ClassUtils.normalize(clazz.getName())); buffer.append("*"); } else { for (int j = 0; j < m; j++) { buffer.append("\\b"); buffer.append(ClassUtils.normalize(ms[j].toPattern())); buffer.append("\\b"); if (j != (m - 1)) { buffer.append('|'); } } } if (i != (n - 1)) { buffer.append('|'); } } list = element.getElementsByTagName("pattern"); n = list.getLength(); if (n != 0 && buffer.length() != 0) { buffer.append('|'); } for (int i = 0; i < n; i++) { String temp = list.item(i).getFirstChild().getNodeValue().trim(); if (temp.startsWith("*") && temp.endsWith("*")) { buffer.append(ClassUtils.normalize(temp)); } else if (temp.startsWith("*")) { buffer.append(ClassUtils.normalize(temp + "$")); } else if (temp.endsWith("*")) { buffer.append(ClassUtils.normalize("^" + temp)); } if (i != (n - 1)) { buffer.append('|'); } } return buffer.toString(); }
    private RE buildPattern(Element root, String elementName)            throws ClassNotFoundException {        Node node = root.getElementsByTagName(elementName).item(0);        //any pattern to no match with methods        String pattern = "\\b9876546321\\b";        if (node != null) {            pattern = this.buildPattern((Element) node);        }        log.debug("Pattern compiled: " + pattern);        return new RE(pattern);    }