Class AbstractConverter<T>

    • Constructor Detail

      • AbstractConverter

        public AbstractConverter()
    • Method Detail

      • convert

        public <G> G convert​(Type targetType,
                             Object sourceValue)
        Description copied from interface: Converter
        Convert the specified input object into an output object of the specified type.
        Specified by:
        convert in interface Converter<T>
        Type Parameters:
        G - the type in which the provided value has to be converted
        Parameters:
        targetType - the type in which the provided value has to be converted
        sourceValue - the value to convert
        Returns:
        the converted value
      • convertToString

        protected String convertToString​(T value)
        Convert the input object into a String.

        N.B.This implementation simply uses the value's toString() method and should be overridden if a more sophisticated mechanism for conversion to a String is required.

        Parameters:
        value - The input value to be converted.
        Returns:
        the converted String value.
      • convertToType

        protected <G extends T> G convertToType​(Type targetType,
                                                Object value)
        Convert the input object into an output object of the specified type.

        Typical implementations will provide a minimum of String --> type conversion.

        Type Parameters:
        G - the type in which the provided value has o be converted
        Parameters:
        targetType - Data type to which this value should be converted.
        value - The input value to be converted.
        Returns:
        The converted value.
        Since:
        3.0M1
      • convertToType

        @Deprecated
        protected <G extends T> G convertToType​(Class<G> type,
                                                Object value)
        Deprecated.
        since 3.0M1 overwrite convertToType(Type, Object) instead
        Convert the input object into an output object of the specified type.

        Typical implementations will provide a minimum of String --> type conversion.

        Type Parameters:
        G - the type in which the provided value has o be converted
        Parameters:
        type - Data type to which this value should be converted.
        value - The input value to be converted.
        Returns:
        The converted value.