當前位置: 首頁>>代碼示例>>Java>>正文


Java ElementKind.RESOURCE_VARIABLE屬性代碼示例

本文整理匯總了Java中javax.lang.model.element.ElementKind.RESOURCE_VARIABLE屬性的典型用法代碼示例。如果您正苦於以下問題:Java ElementKind.RESOURCE_VARIABLE屬性的具體用法?Java ElementKind.RESOURCE_VARIABLE怎麽用?Java ElementKind.RESOURCE_VARIABLE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在javax.lang.model.element.ElementKind的用法示例。


在下文中一共展示了ElementKind.RESOURCE_VARIABLE屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getKind

@DefinedBy(Api.LANGUAGE_MODEL)
public ElementKind getKind() {
    long flags = flags();
    if ((flags & PARAMETER) != 0) {
        if (isExceptionParameter())
            return ElementKind.EXCEPTION_PARAMETER;
        else
            return ElementKind.PARAMETER;
    } else if ((flags & ENUM) != 0) {
        return ElementKind.ENUM_CONSTANT;
    } else if (owner.kind == TYP || owner.kind == ERR) {
        return ElementKind.FIELD;
    } else if (isResourceVariable()) {
        return ElementKind.RESOURCE_VARIABLE;
    } else {
        return ElementKind.LOCAL_VARIABLE;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:18,代碼來源:Symbol.java

示例2: getConstValue

public Object getConstValue() {
    // TODO: Consider if getConstValue and getConstantValue can be collapsed
    if (data == ElementKind.EXCEPTION_PARAMETER ||
        data == ElementKind.RESOURCE_VARIABLE) {
        return null;
    } else if (data instanceof Callable<?>) {
        // In this case, this is a final variable, with an as
        // yet unevaluated initializer.
        Callable<?> eval = (Callable<?>)data;
        data = null; // to make sure we don't evaluate this twice.
        try {
            data = eval.call();
        } catch (Exception ex) {
            throw new AssertionError(ex);
        }
    }
    return data;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:18,代碼來源:Symbol.java

示例3: visitVariable

@Override
public Void visitVariable(VariableElement e, Boolean highlightName) {
    modifier(e.getModifiers());
    
    result.append(getTypeName(info, e.asType(), true));
    
    result.append(' ');
    
    boldStartCheck(highlightName);

    result.append(e.getSimpleName());
    
    boldStopCheck(highlightName);
    
    if (highlightName) {
        if (e.getConstantValue() != null) {
            result.append(" = ");
            result.append(StringEscapeUtils.escapeHtml(e.getConstantValue().toString()));
        }
        
        Element enclosing = e.getEnclosingElement();
        
        if (e.getKind() != ElementKind.PARAMETER && e.getKind() != ElementKind.LOCAL_VARIABLE
                && e.getKind() != ElementKind.RESOURCE_VARIABLE && e.getKind() != ElementKind.EXCEPTION_PARAMETER) {
            result.append(" in ");

            //short typename:
            result.append(getTypeName(info, enclosing.asType(), true));
        }
    }
    
    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:33,代碼來源:GoToSupport.java

示例4: isLocalVariableClosure

private static boolean isLocalVariableClosure(Element el) {
    return el.getKind() == ElementKind.PARAMETER || el.getKind() == ElementKind.LOCAL_VARIABLE
            || el.getKind() == ElementKind.RESOURCE_VARIABLE || el.getKind() == ElementKind.EXCEPTION_PARAMETER;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:4,代碼來源:SemanticHighlighterBase.java

示例5: isResourceVariable

public boolean isResourceVariable() {
    return data == ElementKind.RESOURCE_VARIABLE;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:3,代碼來源:Symbol.java


注:本文中的javax.lang.model.element.ElementKind.RESOURCE_VARIABLE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。