Class Form

All Implemented Interfaces:
Iterable<Parameter>, Collection<Parameter>, List<Parameter>

public class Form extends Series<Parameter>
Form which is a specialized modifiable list of parameters.
Author:
Jerome Louvel
  • Constructor Details

    • Form

      public Form()
      Empty constructor.
    • Form

      public Form(int initialCapacity)
      Constructor.
      Parameters:
      initialCapacity - The initial list capacity.
    • Form

      public Form(List<Parameter> delegate)
      Constructor.
      Parameters:
      delegate - The delegate list.
    • Form

      public Form(Representation webForm)
      Constructor.
      Parameters:
      webForm - The URL encoded Web form.
    • Form

      public Form(Representation webForm, boolean decode)
      Constructor.
      Parameters:
      webForm - The URL encoded Web form.
    • Form

      public Form(String queryString)
      Constructor. Uses UTF-8 as the character set for encoding non-ASCII characters.
      Parameters:
      queryString - The Web form parameters as a string.
    • Form

      public Form(String queryString, boolean decode)
      Constructor. Uses UTF-8 as the character set for encoding non-ASCII characters.
      Parameters:
      queryString - The Web form parameters as a string.
      decode - Indicates if the names and values should be automatically decoded.
    • Form

      public Form(String parametersString, char separator)
      Constructor. Uses UTF-8 as the character set for encoding non-ASCII characters.
      Parameters:
      parametersString - The parameters string to parse.
      separator - The separator character to append between parameters.
    • Form

      public Form(String parametersString, char separator, boolean decode)
      Constructor. Uses UTF-8 as the character set for encoding non-ASCII characters.
      Parameters:
      parametersString - The parameters string to parse.
      separator - The separator character to append between parameters.
      decode - Indicates if the names and values should be automatically decoded.
    • Form

      public Form(String queryString, CharacterSet characterSet)
      Constructor.
      Parameters:
      queryString - The Web form parameters as a string.
      characterSet - The supported character encoding.
    • Form

      public Form(String queryString, CharacterSet characterSet, boolean decode)
      Constructor.
      Parameters:
      queryString - The Web form parameters as a string.
      characterSet - The supported character encoding.
      decode - Indicates if the names and values should be automatically decoded.
    • Form

      public Form(String parametersString, CharacterSet characterSet, char separator)
      Constructor.
      Parameters:
      parametersString - The parameters string to parse.
      characterSet - The supported character encoding.
      separator - The separator character to append between parameters.
    • Form

      public Form(String parametersString, CharacterSet characterSet, char separator, boolean decode)
      Constructor.
      Parameters:
      parametersString - The parameters string to parse.
      characterSet - The supported character encoding.
      separator - The separator character to append between parameters.
      decode - Indicates if the names and values should be automatically decoded.
  • Method Details

    • createEntry

      public Parameter createEntry(String name, String value)
      Description copied from class: Series
      Creates a new entry.
      Overrides:
      createEntry in class Series<Parameter>
      Parameters:
      name - The name of the entry.
      value - The value of the entry.
      Returns:
      A new entry.
    • encode

      public String encode() throws IOException
      Encodes the form using the standard URI encoding mechanism and the UTF-8 character set.
      Returns:
      The encoded form.
      Throws:
      IOException
    • encode

      public String encode(CharacterSet characterSet) throws IOException
      URL encodes the form. The '&' character is used as a separator.
      Parameters:
      characterSet - The supported character encoding.
      Returns:
      The encoded form.
      Throws:
      IOException
    • encode

      public String encode(CharacterSet characterSet, char separator) throws IOException
      URL encodes the form.
      Parameters:
      characterSet - The supported character encoding.
      separator - The separator character to append between parameters.
      Returns:
      The encoded form.
      Throws:
      IOException
    • getMatrixString

      public String getMatrixString()
      Formats the form as a matrix path string. Uses UTF-8 as the character set for encoding non-ASCII characters.
      Returns:
      The form as a matrix string.
      See Also:
    • getMatrixString

      public String getMatrixString(CharacterSet characterSet)
      Formats the form as a query string.
      Parameters:
      characterSet - The supported character encoding.
      Returns:
      The form as a matrix string.
      See Also:
    • getQueryString

      public String getQueryString()
      Formats the form as a query string. Uses UTF-8 as the character set for encoding non-ASCII characters.
      Returns:
      The form as a query string.
    • getQueryString

      public String getQueryString(CharacterSet characterSet)
      Formats the form as a query string.
      Parameters:
      characterSet - The supported character encoding.
      Returns:
      The form as a query string.
    • getWebRepresentation

      public Representation getWebRepresentation()
      Returns the form as a Web representation (MediaType.APPLICATION_WWW_FORM). Uses UTF-8 as the character set for encoding non-ASCII characters.
      Returns:
      The form as a Web representation.
    • getWebRepresentation

      public Representation getWebRepresentation(CharacterSet characterSet)
      Returns the form as a Web representation (MediaType.APPLICATION_WWW_FORM).
      Parameters:
      characterSet - The supported character encoding.
      Returns:
      The form as a Web representation.