FormattedValueConverter (Grails 3.1.10)
Date: 2016-07-28

Package: grails.databinding.converters

## [Java] Interface FormattedValueConverter

- Classes which implement this interface may participate in the data binding process as formatted value converters.

      import org.grails.databinding.converters.FormattedValueConverter

      class FormattedStringValueConverter implements FormattedValueConverter {
          def convert(value, String format) {
              if('UPPERCASE' == format) {
                  value = value.toUpperCase()
              } else if('LOWERCASE' == format) {
                  value = value.toLowerCase()
              }
              value
          }

          Class getTargetType() {
              // specifies the type to which this converter may be applied
              String
          }
      }

  Authors:
    Jeff Brown
  See Also:
    BindingFormat
    org.grails.databinding.SimpleDataBinder
    org.grails.databinding.SimpleDataBinder#registerFormattedValueConverter(FormattedValueConverter)
  Since:
    3.0

- - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `java.lang.Object` | `convert(java.lang.Object value, java.lang.String format)` Return a formatted value
    `java.lang.Class<?>` | `getTargetType()` @return the output type of this converter

- - ### Method Detail

    - #### public java.lang.Object convert(java.lang.Object value, java.lang.String format)

      Return a formatted value

      Parameters:
        `value` - The value to be formatted
        `format` - The format String
      Returns:
        the formatted value

    - #### public java.lang.Class<?> getTargetType()

      Returns:
        the output type of this converter