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>
Direct Known Subclasses:
CacheDirective, Cookie, Expectation

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

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)
          Compares this object with the specified object for order.
static Parameter create(CharSequence name, CharSequence value)
          Creates a parameter.
 void encode(Appendable buffer, CharacterSet characterSet)
          Encodes the parameter and appends the result to the given buffer.
 String encode(CharacterSet characterSet)
          Encodes the parameter using the standard URI encoding mechanism.
 String getName()
          Returns the name of this parameter.
 String getValue()
          Returns the value.
 void setName(String name)
          Sets the name.
 void setValue(String value)
          Sets the value.
 
Methods inherited from class org.restlet.util.Couple
equals, getFirst, getSecond, hashCode, setFirst, setSecond, toString
 
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)
Compares this object with the specified object for order.

Specified by:
compareTo in interface Comparable<Parameter>
Parameters:
o - The object to be compared.
Returns:
A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

encode

public void encode(Appendable buffer,
                   CharacterSet characterSet)
            throws IOException
Encodes the parameter and appends the result to the given buffer. Uses the standard URI encoding mechanism.

Parameters:
buffer - The buffer to append.
characterSet - The supported character encoding
Throws:
IOException

encode

public String encode(CharacterSet characterSet)
              throws IOException
Encodes the parameter using the standard URI encoding mechanism.

Parameters:
characterSet - The supported character encoding.
Returns:
The encoded string.
Throws:
IOException

getName

public String getName()
Returns the name of this parameter.

Returns:
The name of this parameter.

getValue

public String getValue()
Returns the value.

Returns:
The value.

setName

public void setName(String name)
Sets the name.

Parameters:
name - The name.

setValue

public void setValue(String value)
Sets the value.

Parameters:
value - The value.


Copyright © 2005-2011 Noelios Technologies.