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


Java Type.DOUBLE属性代码示例

本文整理汇总了Java中org.apache.bcel.generic.Type.DOUBLE属性的典型用法代码示例。如果您正苦于以下问题:Java Type.DOUBLE属性的具体用法?Java Type.DOUBLE怎么用?Java Type.DOUBLE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.bcel.generic.Type的用法示例。


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

示例1: getNativeValue

/**
 * Returns a string representation of a given object native value.
 * 
 * @param type - a Class object that wraps a data type.
 * @param value - an object that wraps a value of a primitive data type.
 * @return a string that represents a native data type.
 */
public static String getNativeValue(Type type, ConstantValue value) {
    StringBuffer result = new StringBuffer();

    if (type == Type.INT) {
        result.append(value.toString()).append('L');
    } else if (type == Type.BYTE) {
        result.append(value.toString()).append('L');
    } else if (type == Type.LONG) {
        result.append(value.toString()).append("LL");
    } else if (type == Type.FLOAT) {
        result.append(value.toString()).append('f');
    } else if (type == Type.DOUBLE) {
        result.append(value.toString());
    } else if (type == Type.SHORT) {
        result.append(value.toString()).append('L');
    } else if (type == Type.CHAR) {
        result.append(value.toString()).append('L');
    } else if (type == Type.BOOLEAN) {
        result.append(value.toString()).append('L');
    }

    return result.toString();
}
 
开发者ID:shannah,项目名称:cn1,代码行数:30,代码来源:ClazzField.java

示例2: createInstructionPush

private CompoundInstruction createInstructionPush(Element inst) throws IllegalXMLVMException {
    String t = inst.getAttributeValue("type");
    Type type = parseTypeString(t);
    String value = inst.getAttributeValue("value");
    if (type == Type.STRING)
        return new PUSH(constantPoolGen, value);
    else if (type == Type.INT)
        return new PUSH(constantPoolGen, Integer.parseInt(value));
    else if (type == Type.FLOAT)
        return new PUSH(constantPoolGen, Float.parseFloat(value));
    else if (type == Type.DOUBLE)
        return new PUSH(constantPoolGen, Double.parseDouble(value));
    else if (type == Type.LONG)
        return new PUSH(constantPoolGen, Long.parseLong(value));
    else
        throw new IllegalXMLVMException(inst.getName() + " with bad type '" + t + "'");
}
 
开发者ID:shannah,项目名称:cn1,代码行数:17,代码来源:JavaByteCodeOutputProcess.java

示例3: getTypeForPrimitive

protected Type getTypeForPrimitive(Class<?> type) {
    if (type == boolean.class) {
        return Type.BOOLEAN;
    } else if (type == byte.class) {
        return Type.BYTE;
    } else if (type == char.class) {
        return Type.CHAR;
    } else if (type == short.class) {
        return Type.SHORT;
    } else if (type == int.class) {
        return Type.INT;
    } else if (type == long.class) {
        return Type.LONG;
    } else if (type == float.class) {
        return Type.FLOAT;
    } else if (type == double.class) {
        return Type.DOUBLE;
    } else if (type == void.class) {
        return Type.VOID;
    }
    return null;
}
 
开发者ID:abassouk,项目名称:autodao,代码行数:22,代码来源:BaseClassGenAnalysis.java

示例4: add

/**
 * Adds information about the local variable in slot 'slot'. Automatically 
 * adds information for slot+1 if 't' is Type.LONG or Type.DOUBLE.
 * @throws LocalVariableInfoInconsistentException if the new information conflicts
 *         with already gathered information.
 */
public void add(int slot, String name, int startpc, int length, Type t) throws LocalVariableInfoInconsistentException{
	// The add operation on LocalVariableInfo may throw the '...Inconsistent...' exception, we don't throw it explicitely here.
	
	if (slot < 0 || slot >= localVariableInfos.length){
		throw new AssertionViolatedException("Slot number for local variable information out of range.");
	}

	localVariableInfos[slot].add(name, startpc, length, t);
	if (t == Type.LONG) localVariableInfos[slot+1].add(name, startpc, length, LONG_Upper.theInstance());
	if (t == Type.DOUBLE) localVariableInfos[slot+1].add(name, startpc, length, DOUBLE_Upper.theInstance());
}
 
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:17,代码来源:LocalVariablesInfo.java

示例5: getFreeIndexToStart

/**
 * Method getFreeIndexToStart.
 * Returns the index to openConnection allocating the subsequent stack variables
 *
 * @param classes the classes
 * @return int the index
 */
protected int getFreeIndexToStart(Class[] classes) {
    int index = 0;
    for (int i = 0; i < classes.length; i++) {
        if (getBCELType(classes[i]) == Type.DOUBLE || getBCELType(classes[i]) == Type.LONG) {
            index += 2;
        }
        index += 1;
    }

    return index;
}
 
开发者ID:paul-hammant,项目名称:JRemoting,代码行数:18,代码来源:BcelStubGenerator.java

示例6: getBCELPrimitiveType

/**
 * Method getBCELPrimitiveType.
 * Returns the BCEL Type given the Class Name
 *
 * @param javaDataType the java data type
 * @return Type the BCEL type
 */
protected Type getBCELPrimitiveType(String javaDataType) {
    switch (javaDataType.charAt(0)) {

        case 'b':
            if (javaDataType.charAt(1) == 'o') {
                return Type.BOOLEAN;
            } else {
                return Type.BYTE;
            }
        case 'c':
        case 'C':
            return Type.CHAR;
        case 's':
        case 'S':
            return Type.SHORT;
        case 'i':
        case 'I':
            return Type.INT;
        case 'l':
        case 'L':
            return Type.LONG;
        case 'f':
        case 'F':
            return Type.FLOAT;
        case 'd':
        case 'D':
            return Type.DOUBLE;
            //boolean array appears in this format
        case 'Z':
            return Type.BOOLEAN;
        case 'B':
            return Type.BYTE;
        case 'v':
        case 'V':
            return Type.VOID;
    }
    return null;
}
 
开发者ID:paul-hammant,项目名称:JRemoting,代码行数:45,代码来源:BcelStubGenerator.java

示例7: DoubleClass

DoubleClass()
{
   super("Double", Type.DOUBLE, Double.TYPE, "readDouble");
}
 
开发者ID:diana-hep,项目名称:root4j,代码行数:4,代码来源:IntrinsicRootClass.java

示例8: createInterfaceMethodArgs

/**
 * Create interface method's args.
 *
 * @param numberOfArguments  the number of arguments.
 * @param il                 an instruction list
 * @param variableIndex      a varible index.
 * @param paramTypes         parameter types
 * @param generatedClassName the generated class name.
 */
private void createInterfaceMethodArgs(int numberOfArguments, InstructionList il, int variableIndex, Class[] paramTypes, String generatedClassName) {
    Type previousType = null;
    int loadIndex = 0;
    for (int i = 0; i < numberOfArguments; i++) {
        // assigning the obj ref's
        il.append(InstructionFactory.createLoad(Type.OBJECT, variableIndex - 1));
        il.append(new PUSH(constantsPool, i));
        String className = paramTypes[i].getName();
        //adjust for any previous wider datatype (double/long)
        if (previousType != null && (previousType == Type.DOUBLE || previousType == Type.LONG)) {
            ++loadIndex;
        }
        if (paramTypes[i].isPrimitive()) {
            il.append(factory.createNew(getJavaWrapperClass(className)));
            il.append(InstructionConstants.DUP);
            il.append(InstructionFactory.createLoad(getBCELPrimitiveType(className), ++loadIndex));
            il.append(factory.createInvoke(getJavaWrapperClass(className), "<init>", Type.VOID, new Type[]{getBCELPrimitiveType(className)}, Constants.INVOKESPECIAL));
            il.append(InstructionConstants.AASTORE);
        } else {

            //create the static fields for enabling .class calls
            String encodedFieldName;
            if (paramTypes[i].isArray()) {
                int index = className.lastIndexOf('[');
                if (className.charAt(index + 1) == 'L') {
                    encodedFieldName = "array$" + className.substring(1 + index, className.length() - 1).replace('.', '$');
                } else {
                    encodedFieldName = "array$" + className.substring(1 + index, className.length());
                }
            } else {
                encodedFieldName = "class$" + className.replace('.', '$');
            }

            addField(encodedFieldName);
            // ******** TODO assign the obj reference
            il.append(InstructionFactory.createLoad(Type.OBJECT, variableIndex - 1));
            il.append(new PUSH(constantsPool, i));
            il.append(InstructionFactory.createLoad(Type.OBJECT, ++loadIndex));
            il.append(InstructionConstants.AASTORE);

            // *********TODO assign the class ref's
            il.append(InstructionFactory.createLoad(Type.OBJECT, variableIndex));
            il.append(new PUSH(constantsPool, i));
            il.append(factory.createFieldAccess(generatedClassName, encodedFieldName, new ObjectType("java.lang.Class"), Constants.GETSTATIC));
            BranchInstruction ifnull = InstructionFactory.createBranchInstruction(Constants.IFNULL, null);
            il.append(ifnull);
            il.append(factory.createFieldAccess(generatedClassName, encodedFieldName, new ObjectType("java.lang.Class"), Constants.GETSTATIC));
            BranchInstruction goHeadToStoreRef = InstructionFactory.createBranchInstruction(Constants.GOTO, null);
            il.append(goHeadToStoreRef);
            InstructionHandle ifnullStartHere = il.append(new PUSH(constantsPool, className));

            ifnull.setTarget(ifnullStartHere);

            il.append(factory.createInvoke(generatedClassName, "class$", new ObjectType("java.lang.Class"), new Type[]{Type.STRING}, Constants.INVOKESTATIC));
            il.append(InstructionConstants.DUP);
            il.append(factory.createFieldAccess(generatedClassName, encodedFieldName, new ObjectType("java.lang.Class"), Constants.PUTSTATIC));
            InstructionHandle storeClassRef = il.append(InstructionConstants.AASTORE);
            goHeadToStoreRef.setTarget(storeClassRef);

        }
        previousType = getBCELPrimitiveType(className);
    }
}
 
开发者ID:paul-hammant,项目名称:JRemoting,代码行数:72,代码来源:BcelStubGenerator.java

示例9: getJNIType

/**
 * Returns a JNI-style representation of the given data type passed
 * as a Class object.
 * 
 * @param type - a Class object that wraps a data type.
 * @return a string that represents a JNI-style data type.
 */
public static String getJNIType(Type type) {
    StringBuffer result = new StringBuffer();

    String suffix = "";
    if (type instanceof ArrayType) {
        suffix = "Array";
        type = ((ArrayType) type).getElementType();
    }

    if (type instanceof ObjectType) {
        String objectType = "jobject";
        // The suffix length is 0 only if the given type is not an array.
        if (suffix.length() == 0) {
            if (type.equals(Type.STRING)) {
                objectType = "jstring";
            } else if (type.equals(Type.THROWABLE)) {
                objectType = "jthrowable";
            } else if (((ObjectType) type).getClassName()
                    .equals("java.lang.Class")) {
                objectType = "jclass";
            }
        }
        result.append(objectType);
    } else if (type == Type.INT) {
        result.append("jint");
    } else if (type == Type.BYTE) {
        result.append("jbyte");
    } else if (type == Type.LONG) {
        result.append("jlong");
    } else if (type == Type.FLOAT) {
        result.append("jfloat");
    } else if (type == Type.DOUBLE) {
        result.append("jdouble");
    } else if (type == Type.SHORT) {
        result.append("jshort");
    } else if (type == Type.CHAR) {
        result.append("jchar");
    } else if (type == Type.BOOLEAN) {
        result.append("jboolean");
    } else if (type == Type.VOID) {
        result.append("void");
    }

    return result.append(suffix).toString();
}
 
开发者ID:shannah,项目名称:cn1,代码行数:52,代码来源:ClazzMethod.java


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