Interface Converter<A extends Annotation,T>

All Superinterfaces:
Policy<A>, Validator<A>
All Known Implementing Classes:
AbstractConverterSupport, AbstractCustomConverterSupport, AbstractCustomFormatterSupport, BigDecimalConverter, BooleanConverter, ByteConverter, CharacterConverter, DateConverter, DoubleConverter, EnumConverter, FloatConverter, IntegerConverter, LongConverter, ShortConverter

public interface Converter<A extends Annotation,T> extends Validator<A>
Interface for form field validators used by AnnotationValidationInterceptor that convert from string values to single values and vice versa.
  • Method Details

    • convert

      ConversionResult<T> convert(String fieldValue, Class<? extends T> recipientClass) throws Exception
      Returns result of conversion of form field. This is not called if the form value is empty string or null, unless getProcessNoValue() returns true.
      Throws:
      Exception
    • format

      String format(T unformattedValue) throws Exception
      Returns single field value formatted for display in a form field. Only applies single value recipients. Not called if the unformatted value is null, unless getProcessNoValue() returns true..
      Throws:
      Exception
    • getRecipientClass

      Class<T> getRecipientClass()
      Returns types of recipient fields that can receive converted form value or, if recipient should be a list, types of entries.
    • getRecipientFieldName

      String getRecipientFieldName()
      Returns name of field to receive converted form value, which can be empty string to use default.
    • getProcessNoValue

      boolean getProcessNoValue()
      Returns whether convert(java.lang.String, java.lang.Class<? extends T>) converts empty string value, and format(T) formats null value.