Interface DFDataConvertor

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean checkDataAcceptance​(java.lang.Object value, java.lang.Object options)
      Acknowledges that the Converter can work with the passed data.
      java.lang.Object convert​(java.lang.Object value, java.lang.Object options)
      Converts the value.
      java.lang.Object convert​(java.lang.Object value, java.lang.Object options, java.util.List<java.lang.String> messages)
      Converts the value.
      java.lang.Object createOptions()  
    • Method Detail

      • checkDataAcceptance

        boolean checkDataAcceptance​(java.lang.Object value,
                                    java.lang.Object options)
        Acknowledges that the Converter can work with the passed data. The value null can be always accepted, but is converted to null, but it depends on each convertor implementation - this is not guaranteed.
        Parameters:
        value - The value to be converted
        options - Optional options object. Can be null for the default conversion
        Returns:
        True if the value is correct, otherwise false. If true is returned then it's safe to use convert(java.lang.Object, java.lang.Object) method.
      • convert

        java.lang.Object convert​(java.lang.Object value,
                                 java.lang.Object options)
                          throws java.lang.IllegalArgumentException
        Converts the value. Same as the 3 argument form except that feedback cannot be give to the user
        Parameters:
        value - The value to convert. Can be null (if checkDataAcceptance(java.lang.Object, java.lang.Object) returned true, but then null is typically returned. It also depends on convertor implementation.
        options - The conversion options, or null for the default behaviour
        Returns:
        The converted value. Can return null.
        Throws:
        java.lang.IllegalArgumentException - when value is not valid.
      • convert

        java.lang.Object convert​(java.lang.Object value,
                                 java.lang.Object options,
                                 java.util.List<java.lang.String> messages)
                          throws java.lang.IllegalArgumentException
        Converts the value. Conversion options can be specified (the bean can be obtained by the createOptions(). The method will throw an IllegalArgumentException, if the passed value is of unsupported type (first check using checkDataAcceptance(java.lang.Object, java.lang.Object), or the value is invalid.
        Parameters:
        value - The value to convert. Can be null (if checkDataAcceptance(java.lang.Object, java.lang.Object) returned true, but then null is typically returned. It also depends on convertor implementation.
        options - The conversion options, or null for the default behaviour
        messages - Allows messages to be reported to user by being added to this list. Can be null.
        Returns:
        The converted value. Can return null.
        Throws:
        java.lang.IllegalArgumentException - when value is not valid.
      • createOptions

        java.lang.Object createOptions()
        Returns:
        an option bean for the conversion. If the method returns null, the converter does not support any options at all.