javax.servlet.sip
Interface Parameterable

All Superinterfaces:
java.lang.Cloneable
All Known Subinterfaces:
Address

public interface Parameterable
extends java.lang.Cloneable

The Parameterable interface is used to indicate a SIP header field value with optional parameters. All of the Address header fields are Parameterable, including Contact, From, To, Route, Record-Route, and Reply-To. In addition, the header fields Accept, Accept-Encoding, Alert-Info, Call-Info, Content-Disposition, Content-Type, Error-Info, Retry-After and Via are also Parameterable.

Since:
1.1

Method Summary
 java.lang.Object clone()
          Returns a clone of this Parameterable.
 boolean equals(java.lang.Object o)
          Compares the given Parameterable with this one.
 java.lang.String getParameter(java.lang.String key)
          Returns the value of the named parameter, or null if it is not set.
 java.util.Iterator<java.lang.String> getParameterNames()
          Returns an Iterator of the names of all parameters contained in this object.
 java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>> getParameters()
          Returns a Collection view of the parameter name-value mappings contained in this Parameterable.
 java.lang.String getValue()
          Returns the field value as a string.
 void removeParameter(java.lang.String name)
          Removes the named parameter from this object.
 void setParameter(java.lang.String name, java.lang.String value)
          Sets the value of the named parameter.
 void setValue(java.lang.String value)
          Set the value of the field.
 

Method Detail

getValue

java.lang.String getValue()
Returns the field value as a string.

Returns:
the field value, not including parameters

setValue

void setValue(java.lang.String value)
Set the value of the field.

Parameters:
value - the new header field value, not including parameters
Throws:
java.lang.IllegalStateException - if the header field cannot be modified for this object
java.lang.NullPointerException - if the value parameter is null

getParameter

java.lang.String getParameter(java.lang.String key)
Returns the value of the named parameter, or null if it is not set. A zero-length String indicates a flag parameter.

Parameters:
key - a String specifying the parameter name
Returns:
value of the specified parameter
Throws:
java.lang.NullPointerException - if key is null

setParameter

void setParameter(java.lang.String name,
                  java.lang.String value)
Sets the value of the named parameter. If this object previously contained a value for the given parameter name, then the old value is replaced by the specified value. The setting of a flag parameter is indicated by specifying a zero-length String for the parameter value. Calling this method with null value is equivalent to calling removeParameter(String)

Parameters:
name - parameter name
value - new parameter value
Throws:
java.lang.IllegalStateException - if parameters cannot be modified for this object
java.lang.NullPointerException - if name parameter is null

removeParameter

void removeParameter(java.lang.String name)
Removes the named parameter from this object. Nothing is done if the object did not already contain the specific parameter.

Parameters:
name - parameter name
Throws:
java.lang.IllegalStateException - if parameters cannot be modified for this object
java.lang.NullPointerException - if name is null

getParameterNames

java.util.Iterator<java.lang.String> getParameterNames()
Returns an Iterator of the names of all parameters contained in this object. The order is the order of appearance of the parameters in the Parameterable.

Returns:
an Iterator of String objects that are the names of the parameters contained in this object

getParameters

java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>> getParameters()
Returns a Collection view of the parameter name-value mappings contained in this Parameterable. The order is the order of appearance of the parameters in the Parameterable.

Returns:
a Set of Map.Entry objects that are the parameters on this Parameterable.

clone

java.lang.Object clone()
Returns a clone of this Parameterable. The cloned Parameterable has identical field value and parameters.

Returns:
a clone of this Parameterable

equals

boolean equals(java.lang.Object o)
Compares the given Parameterable with this one.

As Parameterables consist of a field-value and an optional set of name-value parameters, the following rules should be used for comparing them:

  1. If the field-value is in the name-addr or addr-spec format, it should be compared using the Address.equals() comparison rules. If the field-value is a sequence of tokens, String comparison should be used.
  2. Parameters should be compared in the same way as URI parameters (as specified in RFC 3261 Section 19.1.4) with no restrictions for well-known URI params.

Overrides:
equals in class java.lang.Object
Parameters:
o - given Parameterable to be compared with this.
Returns:
true if the two Parameterable are deemed equal.