public 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 } }
Type Params | Return Type | Name and description |
---|---|---|
|
public java.lang.Object |
convert(java.lang.Object value, java.lang.String format) Return a formatted value |
|
public java.lang.Class<?> |
getTargetType()
|
Return a formatted value
value
- The value to be formattedformat
- The format String