Hi,
The Expressions which are DoubleValue , LongValue DateValue,StringValue,etc... could all derive from a common interface (e.g Stringable) which has a method such as valueAsString as I`m in a situation where I don`t care what the type of the expression is as long as it can be written to a string e.g I just want to do
Hi,
The Expressions which are DoubleValue , LongValue DateValue,StringValue,etc... could all derive from a common interface (e.g Stringable) which has a method such as valueAsString as I`m in a situation where I don`t care what the type of the expression is as long as it can be written to a string e.g I just want to do
if(obj instanceof Stringable){
..... = ((Stringable)obj).valueAsString();
}
Can't you just use an ExpressionVisitor class like this:
public void visit(DoubleValue doubleValue)
{
// do what you want to do with double, such as
String mystring = doubleValue.toString();
}
public void visit(LongValue longValue);
{
// do what you want to do with long, such as
String mystring = longValue.toString();
}
and so on?