Package com.globalmentor.model
Class NameValuePair<N,V>
java.lang.Object
com.globalmentor.model.DefaultNamed<N>
com.globalmentor.model.NameValuePair<N,V>
- Direct Known Subclasses:
MediaType.Parameter
,NameValuePairMapEntry
,URIQueryParameter
A convenience tuple for a name and a value. The class allows identification (though not necessarily unique) through its name object.
- Author:
- Garret Wilson
-
Constructor Summary
ConstructorsConstructorDescriptionNameValuePair
(N newName, V newValue) Constructor specifying the name and value. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Determines if the given object is another name value pair with the same name and value.static <MEK,
MEV> NameValuePair<MEK, MEV> fromMapEntry
(Map.Entry<MEK, MEV> mapEntry) Static factory method to create a name-value pair from a map entry copy.getID()
getValue()
int
hashCode()
toString()
Methods inherited from class com.globalmentor.model.DefaultNamed
getName
-
Constructor Details
-
NameValuePair
Constructor specifying the name and value.- Parameters:
newName
- The object's new name.newValue
- The object's new value
-
-
Method Details
-
getValue
-
getID
-
fromMapEntry
Static factory method to create a name-value pair from a map entry copy.- Type Parameters:
MEK
- The type of map entry key.MEV
- The type of map entry value.- Parameters:
mapEntry
- The map entry the values of which to use in creating this name/value pair.- Returns:
- A name-value pair from the map entry.
- Throws:
NullPointerException
- if the given map entry isnull
.
-
hashCode
public int hashCode()- Overrides:
hashCode
in classDefaultNamed<N>
- Returns:
- A hashcode value composed from the name.
-
equals
Determines if the given object is another name value pair with the same name and value.- Overrides:
equals
in classDefaultNamed<N>
- 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:
-
toString
- Overrides:
toString
in classDefaultNamed<N>
- Returns:
- A string representation of this object in the format "name=\"value\"".
-