4.3.13 삼항 연산자 (If-Then-Else) by ks
String falseString = parser.parseExpression(
"false ? 'trueExp' : 'falseExp'").getValue(String.class);parser.parseExpression("Name").setValue(societyContext, "IEEE");
societyContext.setVariable("queryName", "Nikola Tesla");
expression = "isMember(#queryName)? #queryName + ' is a member of the ' " +
"+ Name + ' Society' : #queryName + ' is not a member of the ' + Name + ' Society'";
String queryResultString = parser.parseExpression(expression)
.getValue(societyContext, String.class);
// queryResultString = "Nikola Tesla is a member of the IEEE Society"Last updated
Was this helpful?