org.restlet.data

## Class Parameter

- java.lang.Object
- - org.restlet.util.Couple<java.lang.String,java.lang.String>
  - - org.restlet.data.Parameter

All Implemented Interfaces:
  java.lang.Comparable<Parameter>

Direct Known Subclasses:
  CacheDirective, Cookie, Expectation

    public class Parameter
    extends Couple<java.lang.String,java.lang.String>
    implements java.lang.Comparable<Parameter>

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

Author:
  Jerome Louvel

### Constructor Summary

Constructors
Constructor and Description
`Parameter()` Default constructor.
`Parameter(java.lang.String name, java.lang.String value)` Preferred constructor.

### Method Summary

Methods
`int` `compareTo(Parameter o)` Compares this object with the specified object for order.
`static Parameter` `create(java.lang.CharSequence name, java.lang.CharSequence value)` Creates a parameter.
`void` `encode(java.lang.Appendable buffer, CharacterSet characterSet)` Encodes the parameter and appends the result to the given buffer.
`java.lang.String` `encode(CharacterSet characterSet)` Encodes the parameter using the standard URI encoding mechanism.
`java.lang.String` `getName()` Returns the name of this parameter.
`java.lang.String` `getValue()` Returns the value.
`void` `setName(java.lang.String name)` Sets the name.
`void` `setValue(java.lang.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(java.lang.String name,
             java.lang.String value)

Preferred constructor.

Parameters:
  `name` - The name.
  `value` - The value.

### Method Detail

#### create

    public static Parameter create(java.lang.CharSequence name,
                   java.lang.CharSequence value)

Creates a parameter.

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

#### compareTo

    public int compareTo(Parameter o)

Compares this object with the specified object for order.

Specified by:
  `compareTo` in interface `java.lang.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(java.lang.Appendable buffer,
              CharacterSet characterSet)
                throws java.io.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:
  `java.io.IOException`

#### encode

    public java.lang.String encode(CharacterSet characterSet)
                            throws java.io.IOException

Encodes the parameter using the standard URI encoding mechanism.

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

#### getName

    public java.lang.String getName()

Returns the name of this parameter.

Returns:
  The name of this parameter.

#### getValue

    public java.lang.String getValue()

Returns the value.

Returns:
  The value.

#### setName

    public void setName(java.lang.String name)

Sets the name.

Parameters:
  `name` - The name.

#### setValue

    public void setValue(java.lang.String value)

Sets the value.

Parameters:
  `value` - The value.