Package org.pentaho.reporting.libraries.formula.typing

## Class DefaultTypeRegistry

- java.lang.Object
- - org.pentaho.reporting.libraries.formula.typing.DefaultTypeRegistry

- All Implemented Interfaces:
    `TypeRegistry`

      public class DefaultTypeRegistry
      extends java.lang.Object
      implements TypeRegistry

  Creation-Date: 02.11.2006, 12:46:08
  Author:
    Thomas Morgner

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DefaultTypeRegistry()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `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.
    `ArrayCallback` | `convertToArray​(Type type, java.lang.Object value)` |
    `java.util.Date` | `convertToDate​(Type type1, java.lang.Object value)` | Converts the object of the given type into a date.
    `java.lang.Boolean` | `convertToLogical​(Type type1, java.lang.Object value)` | Converts the object of the given type into a boolean.
    `java.lang.Number` | `convertToNumber​(Type sourceType, java.lang.Object value)` | converts the object of the given type into a number.
    `NumberSequence` | `convertToNumberSequence​(Type type, java.lang.Object value, boolean strict)` | Converts the given (type,value) pair into a numeric sequence.
    `Sequence` | `convertToSequence​(Type type, java.lang.Object value)` |
    `java.lang.String` | `convertToText​(Type type1, java.lang.Object value)` | (This conversion is used by the operator implementations.)
    `ExtendedComparator` | `getComparator​(Type type1, Type type2)` | Returns an comparator for the given types.
    `Type` | `guessTypeOfObject​(java.lang.Object o)` |
    `void` | `initialize​(Configuration configuration, FormulaContext formulaContext)` | Deprecated. Use the single-argument function instead.
    `void` | `initialize​(FormulaContext formulaContext)` |

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultTypeRegistry

          public DefaultTypeRegistry()

  - ### Method Detail

    - #### getComparator

          public ExtendedComparator getComparator​(Type type1,
                                                  Type type2)

      Returns an comparator for the given types.
      Specified by:
        `getComparator` in interface `TypeRegistry`
      Parameters:
        `type1` -
        `type2` -
      Returns:

    - #### convertToNumber

          public java.lang.Number convertToNumber​(Type sourceType,
                                                  java.lang.Object value)
                                           throws EvaluationException

      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:
        `convertToNumber` in interface `TypeRegistry`
      Parameters:
        `sourceType` -
        `value` -
      Returns:
      Throws:
        `java.lang.NumberFormatException` - if the type cannot be represented as number.
        `TypeConversionException` - if the type cannot be represented as number.
        `EvaluationException`

    - #### initialize

          public void initialize​(Configuration configuration,
                                 FormulaContext formulaContext)

      Deprecated.
      Use the single-argument function instead.
      Parameters:
        `configuration` -
        `formulaContext` -

    - #### initialize

          public void initialize​(FormulaContext formulaContext)

    - #### convertToText

          public java.lang.String convertToText​(Type type1,
                                                java.lang.Object value)
                                         throws EvaluationException

      Description copied from interface: `TypeRegistry`
      (This conversion is used by the operator implementations.)
      Specified by:
        `convertToText` in interface `TypeRegistry`
      Returns:
        the value as string or an empty string, if the value given is null.
      Throws:
        `TypeConversionException`
        `EvaluationException`

    - #### convertToLogical

          public java.lang.Boolean convertToLogical​(Type type1,
                                                    java.lang.Object value)
                                             throws TypeConversionException

      Description copied from interface: `TypeRegistry`
      Converts the object of the given type into a boolean.
      Specified by:
        `convertToLogical` in interface `TypeRegistry`
      Returns:
        The value as Boolean or null.
      Throws:
        `TypeConversionException`

    - #### convertToDate

          public java.util.Date convertToDate​(Type type1,
                                              java.lang.Object value)
                                       throws EvaluationException

      Description copied from interface: `TypeRegistry`
      Converts the object of the given type into a date.
      Specified by:
        `convertToDate` in interface `TypeRegistry`
      Returns:
        The value as Date or null.
      Throws:
        `EvaluationException`

    - #### convertToArray

          public ArrayCallback convertToArray​(Type type,
                                              java.lang.Object value)
                                       throws EvaluationException

      Specified by:
        `convertToArray` in interface `TypeRegistry`
      Throws:
        `EvaluationException`

    - #### convertToSequence

          public Sequence convertToSequence​(Type type,
                                            java.lang.Object value)
                                     throws EvaluationException

      Specified by:
        `convertToSequence` in interface `TypeRegistry`
      Throws:
        `EvaluationException`

    - #### convertToNumberSequence

          public NumberSequence convertToNumberSequence​(Type type,
                                                        java.lang.Object value,
                                                        boolean strict)
                                                 throws EvaluationException

      Description copied from interface: `TypeRegistry`
      Converts 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:
        `convertToNumberSequence` in interface `TypeRegistry`
      Returns:
      Throws:
        `TypeConversionException`
        `EvaluationException`

    - #### convertTo

          public TypeValuePair convertTo​(Type targetType,
                                         TypeValuePair valuePair)
                                  throws EvaluationException

      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:
        `convertTo` in interface `TypeRegistry`
      Parameters:
        `targetType` -
        `valuePair` -
      Throws:
        `EvaluationException`

    - #### guessTypeOfObject

          public Type guessTypeOfObject​(java.lang.Object o)

      Specified by:
        `guessTypeOfObject` in interface `TypeRegistry`