本文整理匯總了Java中org.odata4j.expression.CastExpression類的典型用法代碼示例。如果您正苦於以下問題:Java CastExpression類的具體用法?Java CastExpression怎麽用?Java CastExpression使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CastExpression類屬於org.odata4j.expression包,在下文中一共展示了CastExpression類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: visit
import org.odata4j.expression.CastExpression; //導入依賴的package包/類
@Override
public void visit(CastExpression expr) {
}
示例2: evaluate
import org.odata4j.expression.CastExpression; //導入依賴的package包/類
public Object evaluate(CommonExpression expression) {
if (expression instanceof LiteralExpression) {
return Expression.literalValue((LiteralExpression) expression);
}
if (expression instanceof BoolCommonExpression) {
return evaluate((BoolCommonExpression) expression);
}
if (expression instanceof EntitySimpleProperty) {
return resolver.resolveVariable(
((EntitySimpleProperty) expression).getPropertyName());
}
if (expression instanceof AddExpression) {
return binaryFunction((BinaryCommonExpression) expression, BinaryFunction.ADD);
}
if (expression instanceof SubExpression) {
return binaryFunction((BinaryCommonExpression) expression, BinaryFunction.SUB);
}
if (expression instanceof MulExpression) {
return binaryFunction((BinaryCommonExpression) expression, BinaryFunction.MUL);
}
if (expression instanceof DivExpression) {
return binaryFunction((BinaryCommonExpression) expression, BinaryFunction.DIV);
}
if (expression instanceof ModExpression) {
return binaryFunction((BinaryCommonExpression) expression, BinaryFunction.MOD);
}
if (expression instanceof ParenExpression) {
return evaluate(((ParenExpression) expression).getExpression());
}
if (expression instanceof BoolParenExpression) {
return evaluate(((BoolParenExpression) expression).getExpression());
}
if (expression instanceof CastExpression) {
CastExpression castExpression = (CastExpression) expression;
EdmSimpleType<?> t = EdmType.getSimple(castExpression.getType());
if (t == null) {
throw new UnsupportedOperationException("Only simple types supported");
}
Class<?> javaType = t.getJavaTypes().iterator().next();
return TypeConverter.convert(evaluate(castExpression.getExpression()), javaType);
}
throw new UnsupportedOperationException("unsupported expression " + expression);
}
示例3: visit
import org.odata4j.expression.CastExpression; //導入依賴的package包/類
@Override
public void visit(CastExpression expr) {
// TODO: Customise this generated block
}