Package com.sun.codemodel

Examples of com.sun.codemodel.JInvocation.invoke()


      // evaluation work.
      HoldingContainer out = generator.declare(e.getMajorType());

      if (out.isOptional()) {
        JBlock blk = generator.getEvalBlock();
        blk.assign(out.getIsSet(), getValueAccessor2.invoke("isSet").arg(indexVariable));
        JConditional jc = blk._if(out.getIsSet().eq(JExpr.lit(1)));
        if (Types.usesHolderForGet(e.getMajorType())) {
          jc._then().add(getValueAccessor.arg(indexVariable).arg(out.getHolder()));
        } else {
          jc._then().assign(out.getValue(), getValueAccessor.arg(indexVariable));
View Full Code Here


          eval.add(getValueAccessor.arg(indexVariable).arg(out.getHolder()));
        }

        if (out.isOptional()) {
          JBlock blk = generator.getEvalBlock();
          blk.assign(out.getIsSet(), getValueAccessor2.invoke("isSet").arg(indexVariable));
          JConditional jc = blk._if(out.getIsSet().eq(JExpr.lit(1)));
          jc._then().add(eval);
        } else {
          generator.getEvalBlock().add(eval);
        }
View Full Code Here

        .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()))));
    //b.assign(vv, JExpr.cast(retClass, ((JExpression) JExpr.cast(wrapperClass, obj) ).invoke(vectorAccess)));
    b.assign(vv, JExpr.cast(retClass, obj ));
    vvDeclaration.put(setup, vv);
View Full Code Here

    else
    {
      JInvocation stringBuilderInvocation = JExpr._new(_stringBuilderClass);
      for (int index = 0; index < schemaJson.length(); index += MAX_SCHEMA_JSON_LENGTH)
      {
        stringBuilderInvocation = stringBuilderInvocation.
          invoke("append").
          arg(schemaJson.substring(index, Math.min(schemaJson.length(), index + MAX_SCHEMA_JSON_LENGTH)));
      }
      stringBuilderInvocation = stringBuilderInvocation.invoke("toString");
      parseSchemaInvocation = _dataTemplateUtilClass.staticInvoke("parseSchema").arg(stringBuilderInvocation);
View Full Code Here

      {
        stringBuilderInvocation = stringBuilderInvocation.
          invoke("append").
          arg(schemaJson.substring(index, Math.min(schemaJson.length(), index + MAX_SCHEMA_JSON_LENGTH)));
      }
      stringBuilderInvocation = stringBuilderInvocation.invoke("toString");
      parseSchemaInvocation = _dataTemplateUtilClass.staticInvoke("parseSchema").arg(stringBuilderInvocation);
    }
    schemaField.init(JExpr.cast(getCodeModel()._ref(schema.getClass()),
                                parseSchemaInvocation));
View Full Code Here

        .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()))));
    //b.assign(vv, JExpr.cast(retClass, ((JExpression) JExpr.cast(wrapperClass, obj) ).invoke(vectorAccess)));
    b.assign(vv, JExpr.cast(retClass, obj ));
    vvDeclaration.put(setup, vv);
View Full Code Here

    JInvocation getValueAccessor = vector.invoke("getAccessor");

    switch(type.getMode()){
    case OPTIONAL:
      eval.assign(out.getIsSet(), getValueAccessor.invoke("isSet").arg(indexVariable));
      eval = eval._if(out.getIsSet().eq(JExpr.lit(1)))._then();

    // fall through
    case REQUIRED:
      switch (type.getMinorType()) {
View Full Code Here

      case INTERVALYEAR:
      case DATE:
      case TIME:
      case TIMESTAMP:
      case BIT:
        eval.assign(out.getValue(), getValueAccessor.invoke("get").arg(indexVariable));
        return;
      case DECIMAL9:
      case DECIMAL18:
        eval.assign(out.getHolder().ref("scale"), vector.invoke("getField").invoke("getScale"));
        eval.assign(out.getHolder().ref("precision"), vector.invoke("getField").invoke("getPrecision"));
View Full Code Here

        return;
      case DECIMAL9:
      case DECIMAL18:
        eval.assign(out.getHolder().ref("scale"), vector.invoke("getField").invoke("getScale"));
        eval.assign(out.getHolder().ref("precision"), vector.invoke("getField").invoke("getPrecision"));
        eval.assign(out.getValue(), getValueAccessor.invoke("get").arg(indexVariable));
        return;
      case DECIMAL28DENSE:
      case DECIMAL28SPARSE:
      case DECIMAL38DENSE:
      case DECIMAL38SPARSE:
View Full Code Here

      }
      case VAR16CHAR:
      case VARBINARY:
      case VARCHAR:
         eval.assign(out.getHolder().ref("buffer"), vector.invoke("getData"));
         JVar se = eval.decl(model.LONG, "startEnd", getValueAccessor.invoke("getStartEnd").arg(indexVariable));
         eval.assign(out.getHolder().ref("start"), JExpr.cast(model._ref(int.class), se));
         eval.assign(out.getHolder().ref("end"), JExpr.cast(model._ref(int.class), se.shr(JExpr.lit(32))));
        return;

      }
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.