org.weborganic.furi
Class URIParameters

java.lang.Object
  extended by org.weborganic.furi.URIParameters
All Implemented Interfaces:
Parameters

public class URIParameters
extends Object
implements Parameters

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

Version:
5 November 2009
Author:
Christophe Lauret

Constructor Summary
URIParameters()
          Creates a new instance.
URIParameters(Map<String,String[]> parameters)
          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.
 Set<String> names()
          Returns the set of parameter names as an unmodifiable set.
 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

URIParameters

public URIParameters()
Creates a new instance.


URIParameters

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

Parameters:
parameters - The map of parameters to supply
Method Detail

set

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

Specified by:
set in interface Parameters
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.

Specified by:
set in interface Parameters
Parameters:
name - The name of the parameter.
values - The values.

names

public Set<String> names()
Returns the set of parameter names as an unmodifiable set.

Specified by:
names in interface Parameters
Returns:
The set of parameter names as an unmodifiable set.

getValue

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

Specified by:
getValue in interface Parameters
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.

Specified by:
getValues in interface Parameters
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

Specified by:
exists in interface Parameters
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:

Specified by:
hasValue in interface Parameters
Parameters:
name - The name of the parameter.
Returns:
true if it has a value; false otherwise.