當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。