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


Java TypeKind.DOUBLE屬性代碼示例

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


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

示例1: 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

示例2: getPrimitiveTypeKind

public TypeKind getPrimitiveTypeKind() {
    switch (typetag) {
        case TypeTags.BOOLEAN:
            return TypeKind.BOOLEAN;
        case TypeTags.BYTE:
            return TypeKind.BYTE;
        case TypeTags.SHORT:
            return TypeKind.SHORT;
        case TypeTags.INT:
            return TypeKind.INT;
        case TypeTags.LONG:
            return TypeKind.LONG;
        case TypeTags.CHAR:
            return TypeKind.CHAR;
        case TypeTags.FLOAT:
            return TypeKind.FLOAT;
        case TypeTags.DOUBLE:
            return TypeKind.DOUBLE;
        case TypeTags.VOID:
            return TypeKind.VOID;
        default:
            throw new AssertionError("unknown primitive type " + this);
    }
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:24,代碼來源:JCTree.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: getPrimitiveTypeKind

public TypeKind getPrimitiveTypeKind() {
    switch (this) {
    case BOOLEAN:
        return TypeKind.BOOLEAN;
    case BYTE:
        return TypeKind.BYTE;
    case SHORT:
        return TypeKind.SHORT;
    case INT:
        return TypeKind.INT;
    case LONG:
        return TypeKind.LONG;
    case CHAR:
        return TypeKind.CHAR;
    case FLOAT:
        return TypeKind.FLOAT;
    case DOUBLE:
        return TypeKind.DOUBLE;
    case VOID:
        return TypeKind.VOID;
    default:
        throw new AssertionError("unknown primitive type " + this);
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:24,代碼來源:TypeTag.java

示例5: fromPrimitiveOrVoidTypeChar

/**
 * Returns the kind from the character describing a primitive or void.
 *
 * @param ch the character
 * @return the kind
 */
public static TypeKind fromPrimitiveOrVoidTypeChar(char ch) {
    switch (ch) {
        case 'Z':
            return TypeKind.BOOLEAN;
        case 'C':
            return TypeKind.CHAR;
        case 'F':
            return TypeKind.FLOAT;
        case 'D':
            return TypeKind.DOUBLE;
        case 'B':
            return TypeKind.BYTE;
        case 'S':
            return TypeKind.SHORT;
        case 'I':
            return TypeKind.INT;
        case 'J':
            return TypeKind.LONG;
        case 'V':
            return TypeKind.VOID;
    }
    throw new IllegalArgumentException("unknown primitive or void type character: " + ch);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:29,代碼來源:APHotSpotSignature.java

示例6: createType

public Tree createType(String typeName, TypeElement scope) {
    TreeMaker make = getTreeMaker();
    TypeKind primitiveTypeKind = null;
    if ("boolean".equals(typeName)) {           // NOI18N
        primitiveTypeKind = TypeKind.BOOLEAN;
    } else if ("byte".equals(typeName)) {       // NOI18N
        primitiveTypeKind = TypeKind.BYTE;
    } else if ("short".equals(typeName)) {      // NOI18N
        primitiveTypeKind = TypeKind.SHORT;
    } else if ("int".equals(typeName)) {        // NOI18N
        primitiveTypeKind = TypeKind.INT;
    } else if ("long".equals(typeName)) {       // NOI18N
        primitiveTypeKind = TypeKind.LONG;
    } else if ("char".equals(typeName)) {       // NOI18N
        primitiveTypeKind = TypeKind.CHAR;
    } else if ("float".equals(typeName)) {      // NOI18N
        primitiveTypeKind = TypeKind.FLOAT;
    } else if ("double".equals(typeName)) {     // NOI18N
        primitiveTypeKind = TypeKind.DOUBLE;
    } else if ("void".equals(typeName)) {     // NOI18N
        primitiveTypeKind = TypeKind.VOID;
    }
    if (primitiveTypeKind != null) {
        return getTreeMaker().PrimitiveType(primitiveTypeKind);
    }
    Tree typeTree = makeQualIdent(typeName);
    if (typeTree == null) {
        // XXX does not handle imports; temporary until issue 102149 is fixed
        TypeMirror typeMirror = copy.getTreeUtilities().parseType(typeName, scope);
        typeTree = make.Type(typeMirror);
    }
    return typeTree;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:33,代碼來源:GenerationUtils.java

示例7: createType

public Tree createType(String typeName, TypeElement scope) {
    TreeMaker make = getTreeMaker();
    TypeKind primitiveTypeKind = null;
    if ("boolean".equals(typeName)) {           // NOI18N
        primitiveTypeKind = TypeKind.BOOLEAN;
    } else if ("byte".equals(typeName)) {       // NOI18N
        primitiveTypeKind = TypeKind.BYTE;
    } else if ("short".equals(typeName)) {      // NOI18N
        primitiveTypeKind = TypeKind.SHORT;
    } else if ("int".equals(typeName)) {        // NOI18N
        primitiveTypeKind = TypeKind.INT;
    } else if ("long".equals(typeName)) {       // NOI18N
        primitiveTypeKind = TypeKind.LONG;
    } else if ("char".equals(typeName)) {       // NOI18N
        primitiveTypeKind = TypeKind.CHAR;
    } else if ("float".equals(typeName)) {      // NOI18N
        primitiveTypeKind = TypeKind.FLOAT;
    } else if ("double".equals(typeName)) {     // NOI18N
        primitiveTypeKind = TypeKind.DOUBLE;
    } else if ("void".equals(typeName)) {     // NOI18N
        primitiveTypeKind = TypeKind.VOID;
    }
    if (primitiveTypeKind != null) {
        return getTreeMaker().PrimitiveType(primitiveTypeKind);
    }
    Tree typeTree = tryCreateQualIdent(typeName);
    if (typeTree == null) {
        // XXX does not handle imports; temporary until issue 102149 is fixed
        TypeMirror typeMirror = copy.getTreeUtilities().parseType(typeName, scope);
        if ( typeMirror == null || typeMirror.getKind() == TypeKind.ERROR ){
            typeTree = getTreeMaker().QualIdent( typeName );
        }
        else {
            typeTree = make.Type(typeMirror);
        }
    }
    return typeTree;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:38,代碼來源:GenerationUtils.java

示例8: getTypeTree

private static Tree getTypeTree(WorkingCopy workingCopy, String typeName) {
    TreeMaker make = workingCopy.getTreeMaker();
    TypeKind primitiveTypeKind = null;
    if ("boolean".equals(typeName)) {           // NOI18N
        primitiveTypeKind = TypeKind.BOOLEAN;
    } else if ("byte".equals(typeName)) {       // NOI18N
        primitiveTypeKind = TypeKind.BYTE;
    } else if ("short".equals(typeName)) {      // NOI18N
        primitiveTypeKind = TypeKind.SHORT;
    } else if ("int".equals(typeName)) {        // NOI18N
        primitiveTypeKind = TypeKind.INT;
    } else if ("long".equals(typeName)) {       // NOI18N
        primitiveTypeKind = TypeKind.LONG;
    } else if ("char".equals(typeName)) {       // NOI18N
        primitiveTypeKind = TypeKind.CHAR;
    } else if ("float".equals(typeName)) {      // NOI18N
        primitiveTypeKind = TypeKind.FLOAT;
    } else if ("double".equals(typeName)) {     // NOI18N
        primitiveTypeKind = TypeKind.DOUBLE;
    } else if ("void".equals(typeName)) {     // NOI18N
        primitiveTypeKind = TypeKind.VOID;
    }
    if (primitiveTypeKind != null) {
        return make.PrimitiveType(primitiveTypeKind);
    } else {
        return createQualIdent(workingCopy, typeName);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:28,代碼來源:MethodModelSupport.java

示例9: doTwoWordFields

private int doTwoWordFields(FieldDefsRes res, TypeElement clazz,
                            int offset, String cname, boolean padWord) {
    boolean first = true;
    List<VariableElement> fields = ElementFilter.fieldsIn(clazz.getEnclosedElements());

    for (VariableElement field: fields) {
        TypeKind tk = field.asType().getKind();
        boolean twoWords = (tk == TypeKind.LONG || tk == TypeKind.DOUBLE);
        if (twoWords && doField(res, field, cname, first && padWord)) {
            offset += 8; first = false;
        }
    }
    return offset;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:14,代碼來源:LLNI.java

示例10: isDouble

boolean isDouble() {
  return type.getKind() == TypeKind.DOUBLE;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:3,代碼來源:Mirrors.java

示例11: isDouble

public boolean isDouble() {
  return returnType.getKind() == TypeKind.DOUBLE;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:3,代碼來源:ValueAttribute.java

示例12: fieldTypeFor

public static FieldType fieldTypeFor(TypeMirror typeMirror, TypeMirror typeConverterType, Elements elements, Types types) {
    if (typeMirror != null) {
        if (typeConverterType != null && !"void".equals(typeConverterType.toString())) {
            return new TypeConverterFieldType(TypeName.get(typeMirror), ClassName.bestGuess(typeConverterType.toString()));
        } else if (typeMirror.getKind() == TypeKind.BOOLEAN) {
            return new BooleanFieldType(true);
        } else if (Boolean.class.getCanonicalName().equals(typeMirror.toString())) {
            return new BooleanFieldType(false);
        } else if (typeMirror.getKind() == TypeKind.BYTE) {
            return new ByteFieldType(true);
        } else if (Byte.class.getCanonicalName().equals(typeMirror.toString())) {
            return new ByteFieldType(false);
        } else if (typeMirror.getKind() == TypeKind.INT) {
            return new IntegerFieldType(true);
        } else if (Integer.class.getCanonicalName().equals(typeMirror.toString())) {
            return new IntegerFieldType(false);
        } else if (typeMirror.getKind() == TypeKind.LONG) {
            return new LongFieldType(true);
        } else if (Long.class.getCanonicalName().equals(typeMirror.toString())) {
            return new LongFieldType(false);
        } else if (typeMirror.getKind() == TypeKind.FLOAT) {
            return new FloatFieldType(true);
        } else if (Float.class.getCanonicalName().equals(typeMirror.toString())) {
            return new FloatFieldType(false);
        } else if (typeMirror.getKind() == TypeKind.DOUBLE) {
            return new DoubleFieldType(true);
        } else if (Double.class.getCanonicalName().equals(typeMirror.toString())) {
            return new DoubleFieldType(false);
        } else if (String.class.getCanonicalName().equals(typeMirror.toString())) {
            return new StringFieldType();
        } else if (Object.class.getCanonicalName().equals(typeMirror.toString())) {
            return new UnknownFieldType();
        } else if (typeMirror instanceof DeclaredType) {
            Annotation annotation = ((DeclaredType) typeMirror).asElement().getAnnotation(JsonObject.class);
            if (annotation != null) {
                return new JsonFieldType(ClassName.bestGuess(typeMirror.toString()));
            }
        }

        return new DynamicFieldType(TypeName.get(typeMirror));
    } else {
        return null;
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:44,代碼來源:FieldType.java

示例13: createType

private static Tree createType(WorkingCopy wc, TypeInfo type) {
    if(type == null) {
        return null;
    }
    String rawType = type.getRawType();
    
    TreeMaker make = wc.getTreeMaker();
    if (rawType.endsWith("[]")) { // NOI18N
        String rawTypeName = rawType.substring(0, rawType.length()-2);
        TypeInfo scalarTypeInfo = new TypeInfo(rawTypeName, type.getDeclaredTypeParameters());
        return make.ArrayType(createType(wc, scalarTypeInfo));
    }
    
    TypeKind primitiveTypeKind = null;
    if ("boolean".equals(rawType)) {           // NOI18N
        primitiveTypeKind = TypeKind.BOOLEAN;
    } else if ("byte".equals(rawType)) {       // NOI18N
        primitiveTypeKind = TypeKind.BYTE;
    } else if ("short".equals(rawType)) {      // NOI18N
        primitiveTypeKind = TypeKind.SHORT;
    } else if ("int".equals(rawType)) {        // NOI18N
        primitiveTypeKind = TypeKind.INT;
    } else if ("long".equals(rawType)) {       // NOI18N
        primitiveTypeKind = TypeKind.LONG;
    } else if ("char".equals(rawType)) {       // NOI18N
        primitiveTypeKind = TypeKind.CHAR;
    } else if ("float".equals(rawType)) {      // NOI18N
        primitiveTypeKind = TypeKind.FLOAT;
    } else if ("double".equals(rawType)) {     // NOI18N
        primitiveTypeKind = TypeKind.DOUBLE;
    } else if ("void".equals(rawType)) {
        primitiveTypeKind = TypeKind.VOID;
    }
    if (primitiveTypeKind != null) {
        return make.PrimitiveType(primitiveTypeKind);
    }
    
    TypeInfo[] declaredTypeParameters = type.getDeclaredTypeParameters();
    if (declaredTypeParameters == null || declaredTypeParameters.length == 0) {
        TypeElement typeElement = wc.getElements().getTypeElement(rawType);
        if (typeElement == null) {
            throw new IllegalArgumentException("Type " + rawType + " cannot be found"); // NOI18N
        }
        return make.QualIdent(typeElement);
    }
    else {
        TypeMirror typeMirror = getTypeMirror(wc, type);
        return make.Type(typeMirror);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:50,代碼來源:JpaControllerUtil.java

示例14: resolveTypeCast

private Object resolveTypeCast(TypeCastTree node, TypeMirror target, Object result, Void p) {
    if (target.getKind() != TypeKind.DECLARED) {
        return null;
    }
    DeclaredType dt = (DeclaredType)target;
    TypeElement e = (TypeElement)dt.asElement();
    if (enhanceProcessing) {
        // accept null constant typecasted to anything as null
        if (result == NULL) {
            return NULL;
        } else if (result == NOT_NULL) {
            // some unspecified reference type...
            return result;
        }
    }
    String qn = e.getQualifiedName().toString();
    // type casts to String are permitted by JLS 15.28
    if ("java.lang.String".equals(qn)) { // NOI18N
        return result instanceof String ? result : null;
    } else if (!enhanceProcessing) {
        // other typecasts are not lised in JLS 15.28
        return null;
    }
    TypeMirror castee = info.getTrees().getTypeMirror(new TreePath(getCurrentPath(), node.getExpression()));
    if (!Utilities.isValidType(castee)) {
        return null;
    }
    if (info.getTypes().isAssignable(castee, target)) {
        return result;
    }
    // a constant of primitive type may be casted / wrapped to the wrapper type
    switch (qn) {
        case "java.lang.Boolean": // NOI18N
            if (result instanceof Boolean) return result;
            break;
        case "java.lang.Byte": // NOI18N
            // the casted expression may be typed as Byte or byte; 
            if (result instanceof Number && castee != null && castee.getKind() == TypeKind.BYTE) 
                return ((Number)result).byteValue();
            break;
        case "java.lang.Character": // NOI18N
            if (result instanceof Number && castee != null && castee.getKind() == TypeKind.CHAR) 
                return Character.valueOf((char)((Number)result).intValue());
            break;
        case "java.lang.Double": // NOI18N
            if (result instanceof Number && castee != null && castee.getKind() == TypeKind.DOUBLE) 
                return ((Number)result).doubleValue();
            break;
        case "java.lang.Float": // NOI18N
            if (result instanceof Number && castee != null && castee.getKind() == TypeKind.FLOAT) 
                return ((Number)result).floatValue();
            break;
        case "java.lang.Integer": // NOI18N
            if (result instanceof Number && castee != null && castee.getKind() == TypeKind.INT) 
                return ((Number)result).intValue();
            break;
        case "java.lang.Long": // NOI18N
            if (result instanceof Number && castee != null && castee.getKind() == TypeKind.LONG) 
                return ((Number)result).longValue();
            break;
        case "java.lang.Short": // NOI18N
            if (result instanceof Number && castee != null && castee.getKind() == TypeKind.SHORT) 
                return ((Number)result).shortValue();
            break;
    }
    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:67,代碼來源:ArithmeticUtilities.java

示例15: fieldDefs

FieldDefsRes fieldDefs(TypeElement clazz, String cname,
                                 boolean bottomMost){
    FieldDefsRes res;
    int offset;
    boolean didTwoWordFields = false;

    TypeElement superclazz = (TypeElement) types.asElement(clazz.getSuperclass());

    if (superclazz != null) {
        String supername = superclazz.getQualifiedName().toString();
        res = new FieldDefsRes(clazz,
                               fieldDefs(superclazz, cname, false),
                               bottomMost);
        offset = res.parent.byteSize;
    } else {
        res = new FieldDefsRes(clazz, null, bottomMost);
        offset = 0;
    }

    List<VariableElement> fields = ElementFilter.fieldsIn(clazz.getEnclosedElements());

    for (VariableElement field: fields) {

        if (doubleAlign && !didTwoWordFields && (offset % 8) == 0) {
            offset = doTwoWordFields(res, clazz, offset, cname, false);
            didTwoWordFields = true;
        }

        TypeKind tk = field.asType().getKind();
        boolean twoWords = (tk == TypeKind.LONG || tk == TypeKind.DOUBLE);

        if (!doubleAlign || !twoWords) {
            if (doField(res, field, cname, false)) offset += 4;
        }

    }

    if (doubleAlign && !didTwoWordFields) {
        if ((offset % 8) != 0) offset += 4;
        offset = doTwoWordFields(res, clazz, offset, cname, true);
    }

    res.byteSize = offset;
    return res;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:45,代碼來源:LLNI.java


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