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


Java TypeKind.OTHER屬性代碼示例

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


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

示例1: isErroneous

/**
 * Checks whether 'e' contains error or is missing. If the passed element is null
 * it's assumed the element could not be resolved and this method returns true. Otherwise,
 * the element's type kind is checked against error constants and finally the erroneous
 * state of the element is checked. 
 * 
 * @param e Element to check or {@code null}
 * @return true, if the element is missing (is {@code null}) or contains errors.
 */
public boolean isErroneous(@NullAllowed Element e) {
    if (e == null) {
        return true;
    }
    if (e.getKind() == ElementKind.MODULE && ((Symbol)e).kind == Kinds.Kind.ERR) {
        return true;
    }
    final TypeMirror type = e.asType();
    if (type == null) {
        return false;
    }
    if (type.getKind() == TypeKind.ERROR || type.getKind() == TypeKind.OTHER) {
        return true;
    }
    if (type instanceof Type) {
        if (((Type)type).isErroneous()) {
            return true;
        }
    }
    return false;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:30,代碼來源:ElementUtilities.java

示例2: unboxBoxed

/**
 * Unbox a wrapper type into a TypeKind. Some additional types are mapped to TypeKinds which cannot really appear in 
 * expressions (at least I hope)
 * 
 * @param tm
 * @return 
 */
private static TypeKind unboxBoxed(TypeMirror tm) {
    TypeElement te = (TypeElement)((DeclaredType)tm).asElement();
    String qn = te.getQualifiedName().toString();
    if (!qn.startsWith("java.lang.")) { // NO18N
        if (qn.equals("java.math.BigInteger")) { // NOI18N
            return TypeKind.WILDCARD;
        }
        return null;
    }
    switch (qn.substring(10)) {
        case "Short": return TypeKind.SHORT; // NOI18N
        case "Long": return TypeKind.LONG; // NOI18N
        case "Byte": return TypeKind.BYTE; // NOI18N
        case "Integer": return TypeKind.INT; // NOI18N
        case "Double": return TypeKind.DOUBLE; // NOI18N
        case "Float": return TypeKind.FLOAT; // NOI18N
        case "Character": return TypeKind.CHAR; // NOI18N
        case "String": return TypeKind.OTHER; // NOI18N
        case "Object": return TypeKind.PACKAGE; // NOI18N
    }
    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,代碼來源:MalformedFormatString.java

示例3: getKind

public TypeKind getKind() {
    switch (tag) {
    case BYTE:      return TypeKind.BYTE;
    case CHAR:      return TypeKind.CHAR;
    case SHORT:     return TypeKind.SHORT;
    case INT:       return TypeKind.INT;
    case LONG:      return TypeKind.LONG;
    case FLOAT:     return TypeKind.FLOAT;
    case DOUBLE:    return TypeKind.DOUBLE;
    case BOOLEAN:   return TypeKind.BOOLEAN;
    case VOID:      return TypeKind.VOID;
    case BOT:       return TypeKind.NULL;
    case NONE:      return TypeKind.NONE;
    default:        return TypeKind.OTHER;
    }
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:16,代碼來源:Type.java

示例4: isErroneous

public boolean isErroneous(@NullAllowed Element e) {
    if (e == null) {
        return true;
    }
    if (e.getKind() == ElementKind.MODULE) {
        return false;
    }
    final TypeMirror type = e.asType();
    if (type == null) {
        return false;
    }
    return type.getKind() == TypeKind.ERROR || type.getKind() == TypeKind.OTHER;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:UnusedImports.java

示例5: isValidType

public static boolean isValidType(TypeMirror m) {
    return m != null && (
            m.getKind() != TypeKind.PACKAGE &&
            m.getKind() != TypeKind.OTHER && 
            m.getKind() != TypeKind.ERROR);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:Utilities.java

示例6: needsErasure

private static boolean needsErasure(TypeMirror typeMirror) {
    return typeMirror.getKind() != TypeKind.NONE && typeMirror.getKind() != TypeKind.VOID && !typeMirror.getKind().isPrimitive() && typeMirror.getKind() != TypeKind.OTHER &&
                    typeMirror.getKind() != TypeKind.NULL;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:4,代碼來源:MethodSubstitutionVerifier.java


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