Search in sources :

Example 1 with ClassDeclaration

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

the class ClassDeclarationJdom method getInnerClassDeclarationByNameMap.

@SuppressWarnings("unchecked")
public Map<String, ClassDeclaration> getInnerClassDeclarationByNameMap() {
    if (innerClassDeclarationByNameMap == null) {
        JXPathContext context = JXPathContext.newContext(classDeclElement);
        innerClassDeclarationByNameMap = new LinkedHashMap<String, ClassDeclaration>();
        for (JavaSourceTokenType tokenType : POSSIBLE_CLASS_DECLARATION_TYPES) {
            final String tokenName = tokenType.getName();
            List<Element> innerClassElementList = context.selectNodes("/" + CLASS_TOP_LEVEL_SCOPE.getName() + "/" + tokenName);
            for (Element innerClassElement : innerClassElementList) {
                ClassDeclaration innerClass = new ClassDeclarationJdom(innerClassElement, DeclarationType.valueOf(tokenName), this);
                innerClassDeclarationByNameMap.put(innerClass.getName(), innerClass);
            }
        }
    }
    return innerClassDeclarationByNameMap;
}
Also used : ClassDeclaration(org.freud.analysed.javasource.ClassDeclaration) JXPathContext(org.apache.commons.jxpath.JXPathContext) Element(org.jdom.Element) JavaSourceTokenType(org.freud.analysed.javasource.parser.JavaSourceTokenType)

Aggregations

JXPathContext (org.apache.commons.jxpath.JXPathContext)1 ClassDeclaration (org.freud.analysed.javasource.ClassDeclaration)1 JavaSourceTokenType (org.freud.analysed.javasource.parser.JavaSourceTokenType)1 Element (org.jdom.Element)1