Package org.geotools.mbstyle.function
Class DefaultIfNullFunction
- Object
-
- ExpressionAbstract
-
- FunctionImpl
-
- DefaultIfNullFunction
-
- All Implemented Interfaces:
Expression
,Function
public class DefaultIfNullFunction extends FunctionImpl
Function that takes an input value, and a default value. If the input value is null (or evaluating it raises an exception), returns the default value; otherwise, returns the input value.
-
-
Field Summary
Fields Modifier and Type Field Description static FunctionName
NAME
-
Fields inherited from class FunctionImpl
functionName
-
Fields inherited from interface Expression
NIL
-
-
Constructor Summary
Constructors Constructor Description DefaultIfNullFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
evaluate(Object object)
Default implementation simply returns the fallbackValue.<T> T
evaluate(Object object, Class<T> context)
Default implementation delegates handling of context conversion to Converters utility class.-
Methods inherited from class FunctionImpl
accept, dispatchArguments, equals, functionName, getFallbackValue, getFunctionName, getName, getParameters, getParameterValue, getParameterValue, hashCode, setFallbackValue, setName, setParameters, toString
-
-
-
-
Field Detail
-
NAME
public static final FunctionName NAME
-
-
Method Detail
-
evaluate
public Object evaluate(Object object)
Description copied from class:FunctionImpl
Default implementation simply returns the fallbackValue.Please override this method to produce a value based on the provided arguments.
- Specified by:
evaluate
in interfaceExpression
- Overrides:
evaluate
in classFunctionImpl
- Parameters:
object
- Object being evaluated; often a Feature- Returns:
- value for the provided object
-
evaluate
public <T> T evaluate(Object object, Class<T> context)
Description copied from class:ExpressionAbstract
Default implementation delegates handling of context conversion to Converters utility class.Subclasses are expected to make use of the Converters utility class (as the easiest way to provide value morphing in conformance with the Filter specification).
- Specified by:
evaluate
in interfaceExpression
- Overrides:
evaluate
in classExpressionAbstract
- Type Parameters:
T
- The type of the returned object.- Parameters:
object
- The object to evaluate the expression against.context
- The type of the resulting value of the expression.- Returns:
- Evaluates the given expression based on the content of the given object an an
instance of
context
.
-
-