Class DefaultValueGenerator

  • All Implemented Interfaces:
    ValueGenerator

    public class DefaultValueGenerator
    extends java.lang.Object
    implements ValueGenerator
    Default implementation of the ValueGenerator
    Since:
    2.6.0
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Date getDefaultDate()
      Gets the default Date, to be used for default values of date fields.
      java.lang.String getValue​(org.apache.commons.httpclient.URI uri, java.lang.String url, java.lang.String fieldId, java.lang.String defaultValue, java.util.List<java.lang.String> definedValues, java.util.Map<java.lang.String,​java.lang.String> envAttributes, java.util.Map<java.lang.String,​java.lang.String> fieldAttributes)
      Generates accurate field values for following types: Text/Password/Search - DEFAULT_TEXT_VALUE number/range - if min is defined, then use min.
      void setDefaultDate​(java.util.Date date)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultValueGenerator

        public DefaultValueGenerator()
    • Method Detail

      • getDefaultDate

        public java.util.Date getDefaultDate()
        Gets the default Date, to be used for default values of date fields.
        Returns:
        the date, never null.
        See Also:
        setDefaultDate(Date)
      • setDefaultDate

        public void setDefaultDate​(java.util.Date date)
      • getValue

        public java.lang.String getValue​(org.apache.commons.httpclient.URI uri,
                                         java.lang.String url,
                                         java.lang.String fieldId,
                                         java.lang.String defaultValue,
                                         java.util.List<java.lang.String> definedValues,
                                         java.util.Map<java.lang.String,​java.lang.String> envAttributes,
                                         java.util.Map<java.lang.String,​java.lang.String> fieldAttributes)
        Generates accurate field values for following types:
        • Text/Password/Search - DEFAULT_TEXT_VALUE
        • number/range - if min is defined, then use min. If max is defined use max, otherwise DEFAULT_NUMBER_VALUE
        • url - http://www.example.com
        • email - [email protected]
        • color - #ffffff
        • tel - 9999999999
        • date/datetime/time/month/week/datetime-local - current date in the proper format
        • file - DEFAULT_FILE_VALUE
        Specified by:
        getValue in interface ValueGenerator
        Parameters:
        uri - the uri
        url - the resolved URL
        fieldId - the name associated with the current field
        defaultValue - the value of 'value attribute' if it has one
        definedValues - the predefined values for the field, if present
        envAttributes - all attributes of the current form
        fieldAttributes - all attributes of the current field
        Returns:
        the default String value for each control type