com.espertech.esper.client.soda.ConstantExpression Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of esper Show documentation
Show all versions of esper Show documentation
Complex event processing and event series analysis component
The newest version!
/*
***************************************************************************************
* Copyright (C) 2006 EsperTech, Inc. All rights reserved. *
* http://www.espertech.com/esper *
* http://www.espertech.com *
* ---------------------------------------------------------------------------------- *
* The software in this package is published under the terms of the GPL license *
* a copy of which has been included with this distribution in the license.txt file. *
***************************************************************************************
*/
package com.espertech.esper.client.soda;
import com.espertech.esper.util.StringValue;
import java.io.StringWriter;
import java.util.Iterator;
import java.util.Map;
/**
* Constant value returns a fixed value for use in expressions.
*/
public class ConstantExpression extends ExpressionBase {
private Object constant;
private String constantType;
private static final long serialVersionUID = 1787950621647511049L;
/**
* Ctor.
*/
public ConstantExpression() {
}
/**
* Returns the type of the constant.
*
* @return type
*/
public String getConstantType() {
return constantType;
}
/**
* Sets the type of the constant.
*
* @param constantType type
*/
public void setConstantType(String constantType) {
this.constantType = constantType;
}
/**
* Ctor.
*
* @param constant is the constant value, or null to represent the null value
*/
public ConstantExpression(Object constant) {
this.constant = constant;
}
/**
* Ctor.
*
* @param constant value
* @param constantType type
*/
public ConstantExpression(Object constant, String constantType) {
this.constant = constant;
this.constantType = constantType;
}
public ExpressionPrecedenceEnum getPrecedence() {
return ExpressionPrecedenceEnum.UNARY;
}
public void toPrecedenceFreeEPL(StringWriter writer) {
if (constant instanceof Iterable) {
Iterable iterable = (Iterable) constant;
Iterator