是否可以在生成的代码中使用三元运算符com.sun.codemodel
?
我希望生成以下语句:
this((A==null)?A.getSomething:null)
是否可以在生成的代码中使用三元运算符com.sun.codemodel
?
我希望生成以下语句:
this((A==null)?A.getSomething:null)
com.sun.codemodel.JOp.cond
应该已经生成了一个三元运算符。查看源代码:
public static JExpression cond(JExpression cond, JExpression ifTrue, JExpression ifFalse) {
return new TernaryOp("?", ":", cond, ifTrue, ifFalse);
}