Class DefaultFormFormatter

java.lang.Object
name.matthewgreet.strutscommons.util.DefaultFormFormatter
All Implemented Interfaces:
FormFormatter

public class DefaultFormFormatter extends Object implements FormFormatter

Implementation of FormFormatter used by FormFormatterInterceptor.

  • Constructor Details

    • DefaultFormFormatter

      public DefaultFormFormatter()
  • Method Details

    • categoriseFields

      protected void categoriseFields(Collection<Field> formFields, Object action, Object form)

      Sets how fields of a form should be formatted (InterceptorContext setting property set 4).

      Can access InterceptorContext property set 3 and lower.

    • endFieldContext

      protected <T> void endFieldContext()
      Called when processing of a form field is complete. Just sets end state and really exists for extending subclasses.
    • endFormProcessing

      protected void endFormProcessing()
      Called when formatting a form completes. Does nothing and really exists for extending subclasses.
    • endInterceptorContext

      protected void endInterceptorContext()
      Called when this interceptor completes (and is not disabled). Does nothing and really exists for extending subclasses.
    • fieldIsForm

      protected boolean fieldIsForm(Field actionField)
      Returns whether Action field is a formatted form.
    • fieldReceivedStoredForm

      protected boolean fieldReceivedStoredForm(Field actionField)
      Returns whether field of an Action received a stored form.
    • filterFormFields

      protected List<Field> filterFormFields(List<Field> allFormFields)
      Returns form fields from parameter excluding those that are definitely not form fields and, if form was processed, excluding those linked to conversionErrors.
    • formatForm

      protected void formatForm()

      Formats all fields of a form. Ignores forms that aren't FormattableForm.

      Can access InterceptorContext property set 3 and lower.

    • getProperties

      protected List<Field> getProperties(Class<?> type)

      Returns all form fields of defined by form class.

      Can access InterceptorContext property set 3 and lower.

    • makeFieldContext

      protected <T> DefaultFormFormatter.FieldContext<T> makeFieldContext()
      Returns an initial execution state about a field.
    • makeInterceptorContext

      protected DefaultFormFormatter.InterceptorContext makeInterceptorContext()
      Returns an initial execution state.
    • processAutoField

      protected <T> void processAutoField()

      Processes field with explicit converter or list converter, which sets formatted value (or values).

      Can access all InterceptorContext properties and FieldContext property set 2 and lower.

    • processConverter

      protected <T> List<String> processConverter()

      Sets formatted value (or values) using explicit or default converter.

      Can access all InterceptorContext properties and FieldContext property set 2 and lower.

    • processDefaultField

      protected <T> void processDefaultField()

      Processes field with default converter or list converter, which sets formatted value (or values).

      Can access all InterceptorContext properties and FieldContext property set 2 and lower.

    • processFormattedValues

      protected void processFormattedValues()

      Processes all formatted values, which is to put fake, formatted versions of the forms on the Value Stack.

      Can access all InterceptorContext properties and FieldContext property set 3 and lower.

    • processListConverter

      protected <T> List<String> processListConverter()

      Sets formatted value (or values) using explicit or default list converter.

      Can access all InterceptorContext properties and FieldContext property set 2 and lower.

    • processManualParameterField

      protected <T> void processManualParameterField()

      Processes form with manually converted fields, which calls format function and adds fake parameters to the Value Stack.

      Can access all InterceptorContext properties. FieldContext does not apply.

    • processNoConversionField

      protected void processNoConversionField()

      Processes string field for no conversion mode, which copies formatted value (or values) as is.

      Can access all InterceptorContext properties and FieldContext property set 2 and lower.

    • processSetOnlyField

      protected void processSetOnlyField()

      Copies form field values to fake form. Set only mode is a throwback to a previous design and only kept if subclasses want to resurrect it.

      Can access all InterceptorContext properties and FieldContext property set 2 and lower.

    • putFakeFormField

      protected <T> void putFakeFormField()

      Copies formatted field value (or values) to fake form.

      Can access all InterceptorContext properties and FieldContext property set 3 and lower.

    • processPairField

      protected <T> void processPairField() throws Exception

      Processes formatted/unformatted field pair with explicit converter or list converter, which sets formatted value (or values) and formatted half of field pair.

      Can access all InterceptorContext properties and FieldContext property set 2 and lower.

      Throws:
      Exception
    • startFieldContext

      protected <T> void startFieldContext(DefaultFormFormatter.FieldContext.FormatMode formatType, InterceptorCommonLibrary.FieldUsage<T> fieldUsage, InterceptorCommonLibrary.PairFieldUsage<T> pairFieldUsage) throws Exception
      Called when algorithm is about to start for a field in earnest and sets FieldContext property set 2.
      Throws:
      Exception
    • startFormProcessing

      protected void startFormProcessing(Field actionField) throws Exception

      Called before formatting a form and sets property set 3 of InterceptorContext.

      Can access InterceptorContext property set 2 and lower.

      Throws:
      Exception
    • startInterceptorContext

      protected void startInterceptorContext(ActionInvocation invocation, PolicyLookup policyLookup)
    • formatForms

      public void formatForms()
      Entry point called by older versions of FormFormatterInterceptor that did not allow alternate sets of converters.
      Specified by:
      formatForms in interface FormFormatter
    • formatForms

      public void formatForms(PolicyLookup policyLookup)
      Entry point called by FormFormatterInterceptor.
      Specified by:
      formatForms in interface FormFormatter