本文整理匯總了Java中com.sun.codemodel.JVar.ref方法的典型用法代碼示例。如果您正苦於以下問題:Java JVar.ref方法的具體用法?Java JVar.ref怎麽用?Java JVar.ref使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.sun.codemodel.JVar
的用法示例。
在下文中一共展示了JVar.ref方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: visitDecimalConstant
import com.sun.codemodel.JVar; //導入方法依賴的package包/類
@Override
public HoldingContainer visitDecimalConstant(DecimalExpression e, ClassGenerator<?> generator)
throws RuntimeException {
CompleteType majorType= e.getCompleteType();
JBlock setup = generator.getBlock(BlockType.SETUP);
JType holderType = majorType.getHolderType(generator.getModel());
JVar var = generator.declareClassField("dec", holderType);
JExpression valueLiteral = JExpr.lit(e.getIntFromDecimal());
JExpression scaleLiteral = JExpr.lit(e.getScale());
JExpression precisionLiteral = JExpr.lit(e.getPrecision());
setup.assign(
var,
generator.getModel().ref(ValueHolderHelper.class).staticInvoke("getNullableDecimalHolder").arg(valueLiteral)
.arg(scaleLiteral).arg(precisionLiteral));
return new HoldingContainer(majorType, var, var.ref("value"), var.ref("isSet"));
}
示例2: declare
import com.sun.codemodel.JVar; //導入方法依賴的package包/類
public HoldingContainer declare(MajorType t, boolean includeNewInstance) {
JType holderType = getHolderType(t);
JVar var;
if (includeNewInstance) {
var = getEvalBlock().decl(holderType, "out" + index, JExpr._new(holderType));
} else {
var = getEvalBlock().decl(holderType, "out" + index);
}
JFieldRef outputSet = null;
if (t.getMode() == DataMode.OPTIONAL) {
outputSet = var.ref("isSet");
}
index++;
return new HoldingContainer(t, var, var.ref("value"), outputSet);
}
示例3: visitQuotedStringConstant
import com.sun.codemodel.JVar; //導入方法依賴的package包/類
@Override
public HoldingContainer visitQuotedStringConstant(QuotedString e, ClassGenerator<?> generator)
throws RuntimeException {
CompleteType completeType = CompleteType.VARCHAR;
JBlock setup = generator.getBlock(BlockType.SETUP);
JType holderType = completeType.getHolderType(generator.getModel());
JVar var = generator.declareClassField("string", holderType);
JExpression stringLiteral = JExpr.lit(e.value);
JExpression buffer = JExpr.direct("context").invoke("getManagedBuffer");
setup.assign(var,
generator.getModel().ref(ValueHolderHelper.class).staticInvoke("getNullableVarCharHolder").arg(buffer).arg(stringLiteral));
return new HoldingContainer((completeType), var, var.ref("value"), var.ref("isSet"));
}
示例4: visitIntervalDayConstant
import com.sun.codemodel.JVar; //導入方法依賴的package包/類
@Override
public HoldingContainer visitIntervalDayConstant(IntervalDayExpression e, ClassGenerator<?> generator)
throws RuntimeException {
CompleteType completeType = CompleteType.INTERVAL_DAY_SECONDS;
JBlock setup = generator.getBlock(BlockType.SETUP);
JType holderType = completeType.getHolderType(generator.getModel());
JVar var = generator.declareClassField("intervalday", holderType);
JExpression dayLiteral = JExpr.lit(e.getIntervalDay());
JExpression millisLiteral = JExpr.lit(e.getIntervalMillis());
setup.assign(
var,
generator.getModel().ref(ValueHolderHelper.class).staticInvoke("getNullableIntervalDayHolder").arg(dayLiteral)
.arg(millisLiteral));
return new HoldingContainer(completeType, var, var.ref("value"), var.ref("isSet"));
}
示例5: declare
import com.sun.codemodel.JVar; //導入方法依賴的package包/類
public HoldingContainer declare(CompleteType t, boolean includeNewInstance) {
JType holderType = t.getHolderType(model);
JVar var;
if (includeNewInstance) {
var = getEvalBlock().decl(holderType, "out" + index, JExpr._new(holderType));
} else {
var = getEvalBlock().decl(holderType, "out" + index);
}
index++;
return new HoldingContainer(t, var, var.ref("value"), var.ref("isSet"));
}