本文整理汇总了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
}