org.jfree.formula.typing

Interface TypeRegistry

public interface TypeRegistry

The type registry manages the known value types.

Author: Thomas Morgner

Method Summary
TypeValuePairconvertTo(Type targetType, TypeValuePair valuePair)
Checks, whether the target type would accept the specified value object and value type.
DateconvertToDate(Type type1, Object value)
Converts the object of the given type into a date.
BooleanconvertToLogical(Type type1, Object value)
Converts the object of the given type into a boolean.
NumberconvertToNumber(Type type1, Object value)
Converts the object of the given type into a number.
NumberSequenceconvertToNumberSequence(Type type, Object value)
StringconvertToText(Type type1, Object value)
(This conversion is used by the operator implementations.)
ExtendedComparatorgetComparator(Type type1, Type type2)
Returns an comparator for the given types.
TypeguessTypeOfObject(Object o)

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 conversion is used by the functions.)

Parameters: targetType valuePair

convertToDate

public Date convertToDate(Type type1, Object value)
Converts the object of the given type into a date.

Parameters: type1 value

Returns: The value as Date or null.

convertToLogical

public Boolean convertToLogical(Type type1, Object value)
Converts the object of the given type into a boolean.

Parameters: type1 value

Returns: The value as Boolean or null.

convertToNumber

public Number convertToNumber(Type type1, Object value)
Converts the object of the given type into a number. If the object is not convertible, a NumberFormatException is thrown. (This conversion is used by the operator implementations.)

Parameters: type1 value

Returns: the value as number or ZERO if the value is unconvertible.

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

convertToNumberSequence

public NumberSequence convertToNumberSequence(Type type, Object value)

convertToText

public String convertToText(Type type1, Object value)
(This conversion is used by the operator implementations.)

Parameters: type1 value

Returns: the value as string or an empty string, if the value given is null.

Throws: TypeConversionException

getComparator

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

Parameters: type1 type2

Returns:

guessTypeOfObject

public Type guessTypeOfObject(Object o)