use of org.apache.commons.jxpath.JXPathContext in project freud by LMAX-Exchange.
the class AnnotationJdom method getAnnotationValueForElement.
private String getAnnotationValueForElement(final Element element) {
final JXPathContext context = JXPathContext.newContext(element);
final Element expr = (Element) context.selectSingleNode("/" + JavaSourceTokenType.EXPR.name() + "/*");
if (expr != null) {
return expr.getText();
} else {
final List<Element> exprList = context.selectNodes("//" + JavaSourceTokenType.EXPR.name() + "/*");
StringBuilder sb = new StringBuilder("{");
for (Element item : exprList) {
sb.append(item.getText()).append(",");
}
sb.setCharAt(sb.length() - 1, '}');
return sb.toString();
}
}
use of org.apache.commons.jxpath.JXPathContext in project freud by LMAX-Exchange.
the class MethodDeclarationJdom method getImplementation.
public CodeBlock getImplementation() {
if (methodCodeBlock == null) {
try {
JXPathContext context = JXPathContext.newContext(methodDeclElement);
Element codeBlockElement = (Element) context.selectSingleNode("/" + JavaSourceTokenType.BLOCK_SCOPE.getName());
methodCodeBlock = CodeBlockJdom.createMethodImplementation(codeBlockElement, this, classDeclaration);
} catch (JXPathException e) {
return null;
}
}
return methodCodeBlock;
}
Aggregations