当前位置: 首页>>代码示例>>Java>>正文


Java NodeWithType类代码示例

本文整理汇总了Java中com.github.javaparser.ast.nodeTypes.NodeWithType的典型用法代码示例。如果您正苦于以下问题:Java NodeWithType类的具体用法?Java NodeWithType怎么用?Java NodeWithType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NodeWithType类属于com.github.javaparser.ast.nodeTypes包,在下文中一共展示了NodeWithType类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resolveTypesUsingImports

import com.github.javaparser.ast.nodeTypes.NodeWithType; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:Axellience,项目名称:vue-gwt,代码行数:22,代码来源:TemplateParser.java

示例2: processSpecialNodeTypes

import com.github.javaparser.ast.nodeTypes.NodeWithType; //导入依赖的package包/类
/**
 * Given a variable declaration of some sort, check it's name and type and
 * if it looks like any of the key type changes between unsafe and atomic
 * queues, perform the conversion to change it's type.
 * 
 * @param node
 * @param name
 */
private static void processSpecialNodeTypes(NodeWithType<?, Type> node, String name) {
    Type type = node.getType();
    if ("buffer".equals(name) && isRefArray(type, "E")) {
        node.setType(atomicRefArrayType((ArrayType) type));
    } else if ("sBuffer".equals(name) && isLongArray(type)) {
        node.setType(atomicLongArrayType());
    } else if (PrimitiveType.longType().equals(type)) {
        switch(name) {
        case "mask":
        case "offset":
        case "seqOffset":
        case "lookAheadElementOffset":
            node.setType(PrimitiveType.intType());
        }
    }
}
 
开发者ID:JCTools,项目名称:JCTools,代码行数:25,代码来源:JavaParsingAtomicArrayQueueGenerator.java

示例3: processSpecialNodeTypes

import com.github.javaparser.ast.nodeTypes.NodeWithType; //导入依赖的package包/类
/**
 * Given a variable declaration of some sort, check it's name and type and
 * if it looks like any of the key type changes between unsafe and atomic
 * queues, perform the conversion to change it's type.
 * 
 * @param node
 * @param name
 */
private static void processSpecialNodeTypes(NodeWithType<?, Type> node, String name) {
    Type type = node.getType();
    if (node instanceof MethodDeclaration && ("newBufferAndOffset".equals(name) || "nextArrayOffset".equals(name))) {
        node.setType(PrimitiveType.intType());
    } else if (PrimitiveType.longType().equals(type)) {
        switch(name) {
        case "offset":
        case "offsetInNew":
        case "offsetInOld":
        case "lookAheadElementOffset":
            node.setType(PrimitiveType.intType());
        }
    } else if (isRefType(type, "LinkedQueueNode")) {
        node.setType(simpleParametricType("LinkedQueueAtomicNode", "E"));
    } else if (isRefArray(type, "E")) {
        node.setType(atomicRefArrayType((ArrayType) type));
    }
}
 
开发者ID:JCTools,项目名称:JCTools,代码行数:27,代码来源:JavaParsingAtomicLinkedQueueGenerator.java


注:本文中的com.github.javaparser.ast.nodeTypes.NodeWithType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。