org.weborganic.uri.template
Class Parameters

java.lang.Object
  extended by org.weborganic.uri.template.Parameters

public class Parameters
extends Object

A class to hold a collection of parameters for use during the expansion process. It provides more convenient functions that the underlying map and handles the rules for parameter values.

Version:
31 December 2008
Author:
Christophe Lauret

Constructor Summary
Parameters()
          Creates a new instance.
Parameters(Map<String,String[]> params)
          Creates a new instance from the specified map.
 
Method Summary
 boolean exists(String name)
          Indicates whether the parameters for the given name has a value.
 String getValue(String name)
          Returns the value for the specified parameter.
 String[] getValues(String name)
          Returns the values for the specified parameter.
 boolean hasValue(String name)
          Indicates whether the parameters for the given name has a value.
 Iterator<String> names()
          Returns an iterator over the names.
 void set(String name, String value)
          Set a parameter with only one value.
 void set(String name, String[] values)
          Set a parameter with only multiple values.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parameters

public Parameters()
Creates a new instance.


Parameters

public Parameters(Map<String,String[]> params)
Creates a new instance from the specified map.

Method Detail

set

public void set(String name,
                String value)
Set a parameter with only one value.

Parameters:
name - The name of the parameter.
value - The value.

set

public void set(String name,
                String[] values)
Set a parameter with only multiple values.

Parameters:
name - The name of the parameter.
values - The values.

names

public Iterator<String> names()
Returns an iterator over the names.

Returns:
An iterator over the parameter names.

getValue

public String getValue(String name)
Returns the value for the specified parameter.

Parameters:
name - The name of the parameter.
Returns:
The value for this parameter or null if not specified.

getValues

public String[] getValues(String name)
Returns the values for the specified parameter.

Parameters:
name - The name of the parameter.
Returns:
The values for this parameter or null if not specified.

exists

public boolean exists(String name)
Indicates whether the parameters for the given name has a value. A parameter has a value if: - it is defined in the parameter list - its array of value has at least one value that is not an empty string

Parameters:
name - The name of the parameter.
Returns:
true if it has a value; false otherwise.

hasValue

public boolean hasValue(String name)
Indicates whether the parameters for the given name has a value. A parameter has a value if: - it is defined in the parameter list - its array of value has at least one value that is not an empty string

Parameters:
name - The name of the parameter.
Returns:
true if it has a value; false otherwise.