Interface CollectionConverter<A extends Annotation,T>

All Superinterfaces:
Policy<A>
All Known Implementing Classes:
AbstractCollectionConverterSupport, AbstractCustomCollectionConverterSupport, AbstractCustomCollectionFormatterSupport, IntegerCSVConverter, StringCSVConverter

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

    • convert

      ConversionResult<T> convert(String formValue, Class<?> recipientFieldClass, 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(Collection<T> unformattedValues) throws Exception
      Returns collection-based field value formatted for display in a form field. Not called if the unformatted value is null or empty collection, unless getProcessNoValue() returns true.
      Throws:
      Exception
    • getMessageType

      Required.MessageType getMessageType()
      Returns whether to write any error message to action errors, field errors, or action messages.
    • getMessage

      String getMessage()
      Returns message set by annotation. Used if getMessageKey() is empty string or it fails to find a message.
    • getMessageKey

      String getMessageKey()
      Returns message key set by annotation, which is used to retrieve message from Action's TextProvider if it's not empty string.
    • getRecipientClass

      Class<T> getRecipientClass()
      Returns item types of recipient collection fields that can receive converted form value. Not to be confused with collection type.
    • 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<?>, java.lang.Class<? extends T>) converts empty string value, and format(java.util.Collection<T>) formats null value or empty collection.