org.restlet.data
Class Parameter

java.lang.Object
  extended by org.restlet.util.Couple<String,String>
      extended by org.restlet.data.Parameter
All Implemented Interfaces:
Comparable<Parameter>, NamedValue<String>

public class Parameter
extends Couple<String,String>
implements Comparable<Parameter>, NamedValue<String>

Multi-usage parameter. Note that the name and value properties are thread safe, stored in volatile members.

Author:
Jerome Louvel

Constructor Summary
Parameter()
          Default constructor.
Parameter(String name, String value)
          Preferred constructor.
 
Method Summary
 int compareTo(Parameter o)
           
static Parameter create(CharSequence name, CharSequence value)
          Creates a parameter.
 void encode(Appendable buffer, CharacterSet characterSet)
          Encodes the parameter into the target buffer.
 String encode(CharacterSet characterSet)
          Encodes the parameter as a string.
 boolean equals(Object obj)
          
 String getName()
          Returns the name of this parameter.
 String getValue()
          Returns the value.
 int hashCode()
          
 void setName(String name)
           
 void setValue(String value)
          Sets the value.
 String toString()
           
 
Methods inherited from class org.restlet.util.Couple
getFirst, getSecond, setFirst, setSecond
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Parameter

public Parameter()
Default constructor.


Parameter

public Parameter(String name,
                 String value)
Preferred constructor.

Parameters:
name - The name.
value - The value.
Method Detail

create

public static Parameter create(CharSequence name,
                               CharSequence value)
Creates a parameter.

Parameters:
name - The parameter name buffer.
value - The parameter value buffer (can be null).
Returns:
The created parameter.
Throws:
IOException

compareTo

public int compareTo(Parameter o)
Specified by:
compareTo in interface Comparable<Parameter>

encode

public void encode(Appendable buffer,
                   CharacterSet characterSet)
            throws IOException
Encodes the parameter into the target buffer.

Parameters:
buffer - The target buffer.
characterSet - The character set to use.
Throws:
IOException

encode

public String encode(CharacterSet characterSet)
              throws IOException
Encodes the parameter as a string.

Parameters:
characterSet - The character set to use.
Returns:
The encoded string?
Throws:
IOException

equals

public boolean equals(Object obj)

Overrides:
equals in class Couple<String,String>

getName

public String getName()
Description copied from interface: NamedValue
Returns the name of this parameter.

Specified by:
getName in interface NamedValue<String>
Returns:
The name of this parameter.

getValue

public String getValue()
Description copied from interface: NamedValue
Returns the value.

Specified by:
getValue in interface NamedValue<String>
Returns:
The value.

hashCode

public int hashCode()

Overrides:
hashCode in class Couple<String,String>

setName

public void setName(String name)

setValue

public void setValue(String value)
Description copied from interface: NamedValue
Sets the value.

Specified by:
setValue in interface NamedValue<String>
Parameters:
value - The value.

toString

public String toString()
Overrides:
toString in class Couple<String,String>


Copyright © 2005-2013 Restlet.