org.pentaho.reporting.libraries.formula.typing

Class DefaultTypeRegistry

public class DefaultTypeRegistry extends Object implements TypeRegistry

Creation-Date: 02.11.2006, 12:46:08

Author: Thomas Morgner

Constructor Summary
DefaultTypeRegistry()
Method Summary
TypeValuePairconvertTo(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.
DateconvertToDate(Type type1, Object value)
BooleanconvertToLogical(Type type1, Object value)
NumberconvertToNumber(Type sourceType, Object value)
converts the object of the given type into a number.
NumberSequenceconvertToNumberSequence(Type type, Object value, boolean strict)
SequenceconvertToSequence(Type type, Object value)
StringconvertToText(Type type1, Object value)
ExtendedComparatorgetComparator(Type type1, Type type2)
Returns an comparator for the given types.
protected NumberFormatgetDefaultNumberFormat()
TypeguessTypeOfObject(Object o)
voidinitialize(Configuration configuration, FormulaContext formulaContext)
voidinitialize(FormulaContext formulaContext)
protected NumberFormat[]loadNumberFormats()

Constructor Detail

DefaultTypeRegistry

public DefaultTypeRegistry()

Method Detail

convertTo

public TypeValuePair convertTo(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.

Parameters: targetType valuePair

UNKNOWN: ObjectEquality is tested at the end of the method for performance reasons only. We just want to detect whether a new object has been created or not.

convertToDate

public Date convertToDate(Type type1, Object value)

convertToLogical

public Boolean convertToLogical(Type type1, Object value)

convertToNumber

public Number convertToNumber(Type sourceType, Object value)
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.

Parameters: sourceType value

Returns:

Throws: NumberFormatException if the type cannot be represented as number.

convertToNumberSequence

public NumberSequence convertToNumberSequence(Type type, Object value, boolean strict)

convertToSequence

public Sequence convertToSequence(Type type, Object value)

convertToText

public String convertToText(Type type1, Object value)

getComparator

public ExtendedComparator getComparator(Type type1, Type type2)
Returns an comparator for the given types.

Parameters: type1 type2

Returns:

getDefaultNumberFormat

protected NumberFormat getDefaultNumberFormat()

guessTypeOfObject

public Type guessTypeOfObject(Object o)

initialize

public void initialize(Configuration configuration, FormulaContext formulaContext)

Deprecated: Use the single-argument function instead.

Parameters: configuration formulaContext

initialize

public void initialize(FormulaContext formulaContext)

loadNumberFormats

protected NumberFormat[] loadNumberFormats()