Package com.globalmentor.net
Class ContentType.Parameter
- java.lang.Object
-
- com.globalmentor.model.DefaultNamed<N>
-
- com.globalmentor.model.NameValuePair<java.lang.String,java.lang.String>
-
- com.globalmentor.net.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 benull
.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
-
-
Field Summary
Fields Modifier and Type Field Description static ContentType.Parameter
CHARSET_UTF_8
The common parametercharset=UTF-8
.
-
Constructor Summary
Constructors Constructor Description Parameter(java.lang.String name, java.lang.String value)
Deprecated.in favor ofof(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 com.globalmentor.model.NameValuePair
fromMapEntry, getID, getValue, toString
-
Methods inherited from class com.globalmentor.model.DefaultNamed
getName
-
-
-
-
Field Detail
-
CHARSET_UTF_8
public static final ContentType.Parameter CHARSET_UTF_8
The common parametercharset=UTF-8
.
-
-
Constructor Detail
-
Parameter
@Deprecated public Parameter(java.lang.String name, java.lang.String value)
Deprecated.in favor ofof(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 isnull
.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 isnull
.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 classNameValuePair<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 classNameValuePair<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 inobject
.- See Also:
DefaultNamed.getName()
,NameValuePair.getValue()
-
-