Examples of decl()


Examples of com.sun.codemodel.JBlock.decl()

        JMethod getFooEndpoint1 = servCls.method(JMod.PUBLIC, serviceIntf, "get"
                + javify(endpoint.getName().getLocalPart()));
        getFooEndpoint1.param(String.class,"url");
        JBlock geBody1 = getFooEndpoint1.body();
        JInvocation getEndp = JExpr.invoke(getFooEndpoint);
        JVar tpe = geBody1.decl(serviceIntf, "var", getEndp );
       
        geBody1.directStatement("org.codehaus.xfire.client.Client.getInstance(var).setUrl(url);");
        geBody1._return(tpe);
    }
View Full Code Here

Examples of com.sun.codemodel.JBlock.decl()

  private void generateSetup(ClassGenerator<?> g, JVar[] workspaceJVars) {
    JCodeModel m = g.getModel();
    JBlock sub = new JBlock(true, true);

    // declare and instantiate argument ObjectInspector's
    JVar oiArray = sub.decl(
      m._ref(ObjectInspector[].class),
      "argOIs",
      JExpr.newArray(m._ref(ObjectInspector.class), argTypes.length));

    JClass oih = m.directClass(ObjectInspectorHelper.class.getCanonicalName());
View Full Code Here

Examples of com.sun.codemodel.JBlock.decl()

       
        JType type = b.getCodeModel()._ref(cls);
        ElementWriterBuilder classBuilder;
        if (info.isElement()) {
            JBlock block = b.getCurrentBlock();
            JVar var = block.decl(type, "_o", JExpr.cast(type, b.getObject()));
            JBlock nullBlock = block._if(var.ne(JExpr._null()))._then();
            b.setCurrentBlock(nullBlock);
           
            classBuilder = b.writeElement(name, type, var);
View Full Code Here

Examples of com.sun.codemodel.JBlock.decl()

                Type rawType = propRef.getRawType();
                String propName = JaxbUtil.getGetter(parentClass, propRef.getName(), rawType);
                   
                JBlock block = classBuilder.getCurrentBlock().block();
                JType mtype = model._ref(MarshallerImpl.class);
                JVar marshaller = block.decl(mtype, "marsh",
                    JExpr.cast(mtype, JExpr.direct("context").invoke("get").arg(JExpr.lit(MarshallerImpl.MARSHALLER))));
               
                JExpression propValue = classBuilder.getObject().invoke(propName);
                if (prop.isCollection()) {
                        JForEach each = block.forEach(getGenericType(rawType), "_o", propValue);
View Full Code Here

Examples of com.sun.codemodel.JBlock.decl()

                                        JType jt) {
       
        if (adapter != null) {
            JVar adapterVar = getAdapter(adapter);
            JBlock block = b.getCurrentBlock();
            JVar valueVar = block.decl(model.ref(String.class), "value", adapterVar.invoke("marshal").arg(object));
           
            JBlock writeNil = block._if(object.eq(JExpr._null()))._then();
            if (nillable) {
                writeNil.add(b.getXSW().invoke("writeXsiNil"));
            }
View Full Code Here

Examples of com.sun.codemodel.JBlock.decl()

        JBlock block = b.getCurrentBlock();

        JConditional cond = block._if(object.ne(JExpr._null()));
        JBlock nullBlock = cond._then();
        b.setCurrentBlock(nullBlock);
        JVar var = nullBlock.decl(model._ref(String.class), "_o",
                                  object.invoke(method));
       
        if (nillable) {
            JConditional cond2 = cond._then()._if(var.ne(JExpr._null()));
           
View Full Code Here

Examples of com.sun.codemodel.JBlock.decl()

        JBlock block = b.getCurrentBlock();

        JConditional cond = block._if(b.getObject().ne(JExpr._null()));
        JBlock nullBlock = cond._then();
        b.setCurrentBlock(nullBlock);
        JVar var = nullBlock.decl(model._ref(String.class),
                                  "_o",
                                  b.getObject().invoke(method));
       
        JConditional cond2 = cond._then()._if(var.ne(JExpr._null()));
           
View Full Code Here

Examples of com.sun.codemodel.JBlock.decl()

    JClass t = model.ref(SchemaChangeException.class);
    JType objClass = model.ref(Object.class);
    JBlock b = getSetupBlock();
    //JExpr.newArray(model.INT).

    JVar fieldArr = b.decl(model.INT.array(), "fieldIds" + index++, JExpr.newArray(model.INT, fieldId.getFieldIds().length));
    int[] fieldIndices = fieldId.getFieldIds();
    for (int i = 0; i < fieldIndices.length; i++) {
       b.assign(fieldArr.component(JExpr.lit(i)), JExpr.lit(fieldIndices[i]));
    }
View Full Code Here

Examples of com.sun.codemodel.JBlock.decl()

    JInvocation invoke = batchName
        .invoke("getValueAccessorById") //
        .arg( vvClass.dotclass())
        .arg(fieldArr);

    JVar obj = b.decl( //
        objClass, //
        getNextVar("tmp"), //
        invoke.invoke(vectorAccess));

    b._if(obj.eq(JExpr._null()))._then()._throw(JExpr._new(t).arg(JExpr.lit(String.format("Failure while loading vector %s with id: %s.", vv.name(), fieldId.toString()))));
View Full Code Here

Examples of com.sun.codemodel.JBlock.decl()

        JVar[] workspaceJVars = declareWorkspaceVectors(g);

        JBlock setupBlock = g.getSetupBlock();

        //Loop through all workspace vectors, to get the minimum of size of all workspace vectors.
        JVar sizeVar = setupBlock.decl(g.getModel().INT, "vectorSize", JExpr.lit(Integer.MAX_VALUE));
        JClass mathClass = g.getModel().ref(Math.class);
        for (int id = 0; id<workspaceVars.length; id ++) {
          if (!workspaceVars[id].isInject()) {
            setupBlock.assign(sizeVar,mathClass.staticInvoke("min").arg(sizeVar).arg(g.getWorkspaceVectors().get(workspaceVars[id]).invoke("getValueCapacity")));
          }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.