Class FieldProcessorRegistry

  • Direct Known Subclasses:
    ContentModelFieldProcessorRegistry

    public class FieldProcessorRegistry
    extends java.lang.Object
    Holds a FieldProcessor implementation for the fields that can be processed by the FormProcessor.
    Since:
    3.4
    Author:
    Nick Smith
    • Constructor Detail

      • FieldProcessorRegistry

        public FieldProcessorRegistry()
    • Method Detail

      • register

        public void register​(java.lang.String key,
                             FieldProcessor processor)
        Registers a FieldProcessor with this registry using the specified key.
        Parameters:
        key - String
        processor - FieldProcessor
      • get

        public FieldProcessor get​(java.lang.String key)
        Returns the FieldProcessor that was registered witht he specified key.
        Parameters:
        key - String
        Returns:
        FieldProcessor
      • buildField

        public Field buildField​(java.lang.String fieldName,
                                FormCreationData data)
        Attempts to build a Field. The method first tries to derive a key from the fieldname, then uses this key to look up a FieldProcessor. This FieldProcessor is then used to generate a Field.
        Parameters:
        fieldName - the name of the field to be created.
        data - A data object used by the FieldProcessor to build the Field.
        Returns:
        a Field or null.
      • getFieldProcessor

        protected FieldProcessor getFieldProcessor​(java.lang.String fieldName)
        Returns a FieldProcessor for the given field name.
        Parameters:
        fieldName - String
        Returns:
        The FieldProcessor implementation for the field or null if there isn't one regsitered.
      • useDefaultProcessor

        protected boolean useDefaultProcessor​(java.lang.String fieldName)
        Determines if the defaultProcessor should be used.
        Parameters:
        fieldName - String
        Returns:
        true if the defaultProcessor should be used, otherwise false.
      • getKey

        protected java.lang.String getKey​(java.lang.String fieldName)
        Derives the key used to look up the FieldProcessor from the fieldName.
        Parameters:
        fieldName - String
        Returns:
        the key used to look up the FieldProcessor.
      • setDefaultProcessor

        public void setDefaultProcessor​(FieldProcessor defaultProcessor)
        Sets the default field processor instance.
        Parameters:
        defaultProcessor - the defaultProcessor to set