Class DefaultTypeRegistry
java.lang.Object
org.pentaho.reporting.libraries.formula.typing.DefaultTypeRegistry
- All Implemented Interfaces:
TypeRegistry
Creation-Date: 02.11.2006, 12:46:08
- Author:
- Thomas Morgner
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertTo(Type targetType, TypeValuePair valuePair) Checks whether the target type would accept the specified value object and value type.
This method is called for auto conversion of fonction parameters using the conversion type declared by the function metadata.convertToArray(Type type, Object value) convertToDate(Type type1, Object value) Converts the object of the given type into a date.convertToLogical(Type type1, Object value) Converts the object of the given type into a boolean.convertToNumber(Type sourceType, Object value) converts the object of the given type into a number.convertToNumberSequence(Type type, Object value, boolean strict) Converts the given (type,value) pair into a numeric sequence.convertToSequence(Type type, Object value) convertToText(Type type1, Object value) (This conversion is used by the operator implementations.)getComparator(Type type1, Type type2) Returns an comparator for the given types.voidinitialize(org.pentaho.reporting.libraries.base.config.Configuration configuration, FormulaContext formulaContext) Deprecated.Use the single-argument function instead.voidinitialize(FormulaContext formulaContext)
-
Constructor Details
-
DefaultTypeRegistry
public DefaultTypeRegistry()
-
-
Method Details
-
getComparator
Returns an comparator for the given types.- Specified by:
getComparatorin interfaceTypeRegistry- Parameters:
type1-type2-- Returns:
-
convertToNumber
converts the object of the given type into a number. If the object is not convertible, a NumberFormatException is thrown. If the given value is null or not parsable as number, return null.- Specified by:
convertToNumberin interfaceTypeRegistry- Parameters:
sourceType-value-- Returns:
- Throws:
NumberFormatException- if the type cannot be represented as number.EvaluationException
-
initialize
public void initialize(org.pentaho.reporting.libraries.base.config.Configuration configuration, FormulaContext formulaContext) Deprecated.Use the single-argument function instead.- Parameters:
configuration-formulaContext-
-
initialize
-
convertToText
Description copied from interface:TypeRegistry(This conversion is used by the operator implementations.)- Specified by:
convertToTextin interfaceTypeRegistry- Parameters:
type1-value-- Returns:
- the value as string or an empty string, if the value given is null.
- Throws:
EvaluationException
-
convertToLogical
Description copied from interface:TypeRegistryConverts the object of the given type into a boolean.- Specified by:
convertToLogicalin interfaceTypeRegistry- Parameters:
type1-value-- Returns:
- The value as Boolean or null.
- Throws:
TypeConversionException
-
convertToDate
Description copied from interface:TypeRegistryConverts the object of the given type into a date.- Specified by:
convertToDatein interfaceTypeRegistry- Parameters:
type1-value-- Returns:
- The value as Date or null.
- Throws:
EvaluationException
-
convertToArray
- Specified by:
convertToArrayin interfaceTypeRegistry- Throws:
EvaluationException
-
convertToSequence
- Specified by:
convertToSequencein interfaceTypeRegistry- Throws:
EvaluationException
-
convertToNumberSequence
public NumberSequence convertToNumberSequence(Type type, Object value, boolean strict) throws EvaluationException Description copied from interface:TypeRegistryConverts the given (type,value) pair into a numeric sequence. If the flag "strictTypeChecks" is set to true, the value sequence will only evaluate numeric values. A non-strict sequence will treat text as zero and logical values as 0 or 1.- Specified by:
convertToNumberSequencein interfaceTypeRegistry- Parameters:
type-value-strict-- Returns:
- Throws:
EvaluationException
-
convertTo
Checks whether the target type would accept the specified value object and value type.
This method is called for auto conversion of fonction parameters using the conversion type declared by the function metadata.- Specified by:
convertToin interfaceTypeRegistry- Parameters:
targetType-valuePair-- Throws:
EvaluationException
-
guessTypeOfObject
- Specified by:
guessTypeOfObjectin interfaceTypeRegistry
-