Search in sources :

Example 1 with ImportDeclaration

use of org.freud.analysed.javasource.ImportDeclaration in project freud by LMAX-Exchange.

the class JavaSourceJdom method parseImportDeclaration.

private List<ImportDeclaration> parseImportDeclaration() {
    try {
        final JXPathContext context = JXPathContext.newContext(root);
        final List importNodes = context.selectNodes("/" + JAVA_SOURCE_ROOT_ELEMENT_NAME + "/" + JavaSourceTokenType.IMPORT.name());
        importDeclarations = new ArrayList<ImportDeclaration>(importNodes.size());
        for (Object importNode : importNodes) {
            importDeclarations.add(new ImportDeclarationJdom((Element) importNode));
        }
    } catch (JXPathException e) {
        importDeclarations = emptyList();
    }
    return importDeclarations;
}
Also used : JXPathContext(org.apache.commons.jxpath.JXPathContext) Element(org.jdom.Element) ImportDeclaration(org.freud.analysed.javasource.ImportDeclaration) JXPathException(org.apache.commons.jxpath.JXPathException) Collections.emptyList(java.util.Collections.emptyList) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

ArrayList (java.util.ArrayList)1 Collections.emptyList (java.util.Collections.emptyList)1 List (java.util.List)1 JXPathContext (org.apache.commons.jxpath.JXPathContext)1 JXPathException (org.apache.commons.jxpath.JXPathException)1 ImportDeclaration (org.freud.analysed.javasource.ImportDeclaration)1 Element (org.jdom.Element)1