Class ConstantExpressionTemplate

java.lang.Object
ch.andre601.expressionparser.templates.ConstantExpressionTemplate
All Implemented Interfaces:
ExpressionTemplate

public class ConstantExpressionTemplate extends Object implements ExpressionTemplate

An ExpressionTemplate instance that holds a ToBooleanExpression, ToDoubleExpression and ToStringExpression instance to call.

Static methods are available to create a new instance from a boolean, double or String respectively, with each having a different way of converting the provided value into the other outputs:

Input
Output
Boolean Double String
Boolean Use as-is true if not 0, else false Converted using Boolean.parseBoolean(String)
Double 1.0 when true, else 0.0 Use as-is Parsed using Double.parseDouble(String)
Should it fail uses String length
String Converted using Boolean.toString(boolean) Converted using Integer.toString(int) if Integer, else Double.toString(double) Use as-is