Class ContentType.Parameter

  • All Implemented Interfaces:
    IDed<java.lang.String>, Named<java.lang.String>, Valued<java.lang.String>
    Enclosing class:
    ContentType

    public static class ContentType.Parameter
    extends NameValuePair<java.lang.String,​java.lang.String>
    A content type parameter name/value pair. Neither the name nor the value of a content type parameter can be null.

    The names of parameters are compared in a case-insensitive manner as per RFC 2046.

    This class considers value quoting a syntax issue of serialization, and thus interprets all values as logical, non-quoted values.

    Author:
    Garret Wilson
    • Constructor Summary

      Constructors 
      Constructor Description
      Parameter​(java.lang.String name, java.lang.String value)
      Deprecated.
      in favor of of(String, String); to be made private in next major version.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object object)
      Determines if the given object is another name value pair with the same name and value.
      int hashCode()
      This version returns a consistent hash code for all cases of a parameter name.
      static ContentType.Parameter of​(java.lang.String name, java.lang.String value)
      Static factory method specifying the name and value.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • CHARSET_UTF_8

        public static final ContentType.Parameter CHARSET_UTF_8
        The common parameter charset=UTF-8.
    • Constructor Detail

      • Parameter

        @Deprecated
        public Parameter​(java.lang.String name,
                         java.lang.String value)
        Deprecated.
        in favor of of(String, String); to be made private in next major version.
        Constructor specifying the name and value.
        Parameters:
        name - The parameter name.
        value - The parameter value.
        Throws:
        java.lang.NullPointerException - if the given name and/or value is null.
        ArgumentSyntaxException - if the name is not a token; or the value contains a space, non-ASCII, or control character.
        See Also:
        ContentType.isToken(CharSequence)
    • Method Detail

      • of

        public static ContentType.Parameter of​(@Nonnull
                                               java.lang.String name,
                                               @Nonnull
                                               java.lang.String value)
        Static factory method specifying the name and value.
        Parameters:
        name - The parameter name.
        value - The parameter value.
        Returns:
        A content type for the indicated name and value.
        Throws:
        java.lang.NullPointerException - if the given name and/or value is null.
        ArgumentSyntaxException - if the name is not a token; or the value contains a space, non-ASCII, or control character.
        See Also:
        ContentType.isToken(CharSequence)
      • hashCode

        public int hashCode()
        This version returns a consistent hash code for all cases of a parameter name.
        Overrides:
        hashCode in class NameValuePair<java.lang.String,​java.lang.String>
        Returns:
        A hashcode value composed from the name.
      • equals

        public boolean equals​(java.lang.Object object)
        Determines if the given object is another name value pair with the same name and value. This version compares names in a case-insensitive manner.
        Overrides:
        equals in class NameValuePair<java.lang.String,​java.lang.String>
        Parameters:
        object - The object with which to compare this name/value pair.
        Returns:
        true if this name/value pair equals that specified in object.
        See Also:
        DefaultNamed.getName(), NameValuePair.getValue()