Search in sources :

Example 1 with NodeWithType

use of com.github.javaparser.ast.nodeTypes.NodeWithType in project vue-gwt by Axellience.

the class TemplateParser method resolveTypesUsingImports.

/**
 * Resolve all the types in the expression.
 * This will replace the Class with the full qualified name using the template imports.
 * @param expression A Java expression from the Template
 */
private void resolveTypesUsingImports(Expression expression) {
    if (expression instanceof NodeWithType) {
        NodeWithType nodeWithType = ((NodeWithType) expression);
        nodeWithType.setType(getQualifiedName(nodeWithType.getType()));
    }
    // Recurse downward in the expression
    expression.getChildNodes().stream().filter(Expression.class::isInstance).map(Expression.class::cast).forEach(this::resolveTypesUsingImports);
}
Also used : NodeWithType(com.github.javaparser.ast.nodeTypes.NodeWithType) TemplateExpression(com.axellience.vuegwt.processors.component.template.parser.result.TemplateExpression) Expression(com.github.javaparser.ast.expr.Expression)

Aggregations

TemplateExpression (com.axellience.vuegwt.processors.component.template.parser.result.TemplateExpression)1 Expression (com.github.javaparser.ast.expr.Expression)1 NodeWithType (com.github.javaparser.ast.nodeTypes.NodeWithType)1