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


Java Type.STRING属性代码示例

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


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

示例1: createHelperMethodForDotClassCalls

/**
 * Creates a method class$(String) which is used
 * during SomeClass.class instruction
 *
 * @param generatedClassName the instance class name
 */
protected void createHelperMethodForDotClassCalls(String generatedClassName) {
    InstructionList il = new InstructionList();
    MethodGen method = new MethodGen(Constants.ACC_STATIC, new ObjectType("java.lang.Class"), new Type[]{Type.STRING}, new String[]{"arg0"}, "class$", generatedClassName, il, constantsPool);
    InstructionHandle ih0 = il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
    il.append(factory.createInvoke("java.lang.Class", "forName", new ObjectType("java.lang.Class"), new Type[]{Type.STRING}, Constants.INVOKESTATIC));
    InstructionHandle ih4 = il.append(InstructionFactory.createReturn(Type.OBJECT));
    InstructionHandle ih5 = il.append(InstructionFactory.createStore(Type.OBJECT, 1));
    il.append(factory.createNew("java.lang.NoClassDefFoundError"));
    il.append(InstructionConstants.DUP);
    il.append(InstructionFactory.createLoad(Type.OBJECT, 1));
    il.append(factory.createInvoke("java.lang.Throwable", "getMessage", Type.STRING, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
    il.append(factory.createInvoke("java.lang.NoClassDefFoundError", "<init>", Type.VOID, new Type[]{Type.STRING}, Constants.INVOKESPECIAL));
    il.append(InstructionConstants.ATHROW);
    method.addExceptionHandler(ih0, ih4, ih5, new ObjectType("java.lang.ClassNotFoundException"));
    method.setMaxStack();
    method.setMaxLocals();
    classGen.addMethod(method.getMethod());
    il.dispose();
}
 
开发者ID:paul-hammant,项目名称:JRemoting,代码行数:25,代码来源:BcelStubGenerator.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: mergeReferenceTypes

@Override
protected ReferenceType mergeReferenceTypes(ReferenceType aRef, ReferenceType bRef) throws DataflowAnalysisException {
    byte aType = aRef.getType();
    byte bType = bRef.getType();

    if (isExtendedStringType(aType) || isExtendedStringType(bType)) {
        // If both types are the same extended String type,
        // then the same type is returned. Otherwise, extended
        // types are downgraded to plain java.lang.String,
        // and a standard merge is applied.
        if (aType == bType) {
            return aRef;
        }

        if (isExtendedStringType(aType)) {
            aRef = Type.STRING;
        }
        if (isExtendedStringType(bType)) {
            bRef = Type.STRING;
        }
    }

    return super.mergeReferenceTypes(aRef, bRef);
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:24,代码来源:FindRefComparison.java

示例4: getJavaTypeForMethod

/**
 * The type that will be used when this class is stored as a member, or as a return
 * type from a method.
 */
protected Type getJavaTypeForMethod()
{
   return Type.STRING;
}
 
开发者ID:diana-hep,项目名称:root4j,代码行数:8,代码来源:TString.java

示例5: getJavaType

public Type getJavaType()
{
   return Type.STRING;
}
 
开发者ID:diana-hep,项目名称:root4j,代码行数:4,代码来源:StreamerInfoNew.java

示例6: generateMain

void generateMain(ClassGen clg, Method origMain) {

        InstructionList il = new InstructionList();

        MethodGen new_main = new MethodGen(Constants.ACC_STATIC
            | Constants.ACC_PUBLIC, Type.VOID, new Type[] { new ArrayType(
            Type.STRING, 1) }, new String[] { "argv" }, "main", clg
            .getClassName(), il, clg.getConstantPool());

        il.append(ins_f.createNew(cashmereType));
        il.append(new DUP());
        il.append(ins_f.createInvoke("ibis.cashmere.impl.Cashmere", "<init>",
            Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));
        il.append(ins_f.createInvoke("ibis.cashmere.impl.Cashmere", "isMaster",
            Type.BOOLEAN, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
        BranchHandle ifcmp = il.append(new IFEQ(null));

        InstructionHandle origMain_handle = il.append(new ALOAD(0));
        
        InstructionHandle try_start = il.append(ins_f.createInvoke(clg
            .getClassName(), origMain.getName(), Type.VOID,
            new Type[] { new ArrayType(Type.STRING, 1) },
            Constants.INVOKESTATIC));

        BranchHandle try_end = il.append(new GOTO(null));

        InstructionHandle e_handler = il.append(getCashmere(ins_f));
        il.append(new SWAP());
        il.append(ins_f.createInvoke("ibis.cashmere.impl.Cashmere", "exit",
                Type.VOID, new Type[] { new ObjectType("java.lang.Throwable")},
                Constants.INVOKEVIRTUAL));

        BranchHandle gto2 = il.append(new GOTO(null));

        InstructionHandle ifeq_target = il.append(getCashmere(ins_f));
        ifcmp.setTarget(ifeq_target);
        il.append(ins_f.createInvoke("ibis.cashmere.impl.Cashmere", "client",
            Type.VOID, Type.NO_ARGS, Constants.INVOKEVIRTUAL));

        il.append(getCashmere(ins_f));
        il.append(ins_f.createInvoke("ibis.cashmere.impl.Cashmere", "isMaster",
            Type.BOOLEAN, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
        il.append(new IFNE(origMain_handle));

        InstructionHandle gto_target = il.append(getCashmere(ins_f));
        try_end.setTarget(gto_target);

        il.append(ins_f.createInvoke("ibis.cashmere.impl.Cashmere", "exit",
            Type.VOID, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
        InstructionHandle gto2_target = il.append(new RETURN());
        gto2.setTarget(gto2_target);

        new_main.addExceptionHandler(try_start, try_end, e_handler,
            new ObjectType("java.lang.Throwable"));
        new_main.setMaxStack();
        new_main.setMaxLocals();

        new_main.addLocalVariable("argv", new ArrayType(Type.STRING, 1), 0,
            origMain_handle, null);

        removeLocalTypeTables(new_main);

        Method main = new_main.getMethod();
        gen_c.addMethod(main);
    }
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:65,代码来源:Cashmerec.java

示例7: processParameter

protected void processParameter(ParsedMethod m, Argument arg,
        InstructionList il, String queryClass) {
    Param param = null;
    Position pos = null;
    String tempType = null;
    for (Annotation a : arg.getAnnotations()) {
        if (a instanceof Temporal) {
            Temporal t = ((Temporal) a);
            tempType = t.value().name();
            continue;
        } else if (a instanceof Param) {
            param = (Param) a;
            break;
        } else if (a instanceof Position) {
            pos = (Position) a;
            break;
        } else if (a instanceof MaxResults) {
            processQuerySetOperation(m, arg, il, "setMaxResults",
                queryClass);
            return;
        } else if (a instanceof FirstResult) {
            processQuerySetOperation(m, arg, il, "setFirstResult",
                queryClass);
            return;
        }
    }

    if ((param == null) == (pos == null)) {
        throw new IllegalArgumentException("Unbound parameter #"
                + arg.getArgNo() + " in " + m);
    }

    int maxRep = 1;
    if (pos != null) {
        maxRep = pos.value().length;
    }
    for (int j = 0; j < maxRep; j++) {
        Type parmType;
        if (pos != null) {
            il.append(new PUSH(_cp, pos.value()[j]));
            parmType = Type.INT;
        } else {
            il.append(new PUSH(_cp, param.value()));
            parmType = Type.STRING;
        }
        Class<?> type = arg.getArgumentClass();
        if (type == Calendar.class || type == Date.class) {
            if (tempType == null)
                tempType = TemporalType.TIMESTAMP.name();
        }
        if (tempType != null
                && (type != Calendar.class && type != Date.class))
            throw new IllegalArgumentException(
                    "Temporal annotation on non-Date, non-Calendar parameter on "
                            + m);
        arg.pushAsObject(il);
        if (tempType == null) {
            il.append(_factory.createInvoke(queryClass, "setParameter",
                new ObjectType(queryClass), new Type[] { parmType,
                        Type.OBJECT }, Constants.INVOKEINTERFACE));
        } else {
            il.append(_factory.createFieldAccess(
                "javax.persistence.TemporalType", tempType, TEMPORAL_TYPE,
                Constants.GETSTATIC));
            il.append(_factory.createInvoke(queryClass, "setParameter",
                new ObjectType(queryClass),
                new Type[] { parmType, arg.getType(), TEMPORAL_TYPE },
                Constants.INVOKEINTERFACE));
        }
    }
}
 
开发者ID:abassouk,项目名称:autodao,代码行数:71,代码来源:DAOAnalysis.java


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