站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBOSS Portal 2.2 API 英文版文档

Parameters - JBOSS Portal 2.2 API 英文版文档


org.jboss.portal.server.util
Class Parameters

java.lang.Object
  extended byorg.jboss.portal.server.util.Parameters
All Implemented Interfaces:
java.io.Serializable

public class Parameters
extends java.lang.Object
implements java.io.Serializable

A set of parameters.

See Also:
Serialized Form

Constructor Summary
Parameters()
          Creates an empty parameter set.
Parameters(java.util.Map parameterMap)
          Copy the parameter map to initialize the object state.
Parameters(Parameters parameters)
          Copy constructor.
 
Method Summary
 void clear()
          Clear all the parameters.
 java.util.Map getMap()
          Return the a map containing the values.
 java.util.Enumeration getNames()
          Return all the parameter names.
 int getSize()
          Return the size.
 java.lang.String getValue(java.lang.String name)
          Return the parameter value or null if it does not exist.
 java.lang.String[] getValues(java.lang.String name)
          Return the parameter values or null if it does not exist.
 void remove(java.lang.String name)
          Remove a parameter.
 void replace(java.util.Map map)
          Replace all the parameters.
 void replace(Parameters parameters)
          Replace all the parameters.
 void setValue(java.lang.String name, java.lang.String value)
          Set the a parameter value.
 void setValues(java.lang.String name, java.lang.String[] values)
          Set the parameter values.
 java.lang.String toString()
           
protected  void validateMap(java.util.Map map)
          Validate the parameter map.
protected  void validateStringArray(java.lang.String[] values)
          Validate the string array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Parameters

public Parameters()
Creates an empty parameter set.


Parameters

public Parameters(Parameters parameters)
Copy constructor.

Throws:
java.lang.IllegalArgumentException - if the parameters is null

Parameters

public Parameters(java.util.Map parameterMap)
Copy the parameter map to initialize the object state.

Throws:
java.lang.IllegalArgumentException - if the parameter map is null or not valid
Method Detail

getValue

public java.lang.String getValue(java.lang.String name)
                          throws java.lang.IllegalArgumentException
Return the parameter value or null if it does not exist.

Parameters:
name - the parameter name
Returns:
the parameter value or null if it does not exist
Throws:
java.lang.IllegalArgumentException - if the name is null

getNames

public java.util.Enumeration getNames()
Return all the parameter names.

Returns:
the parameter names

getValues

public java.lang.String[] getValues(java.lang.String name)
                             throws java.lang.IllegalArgumentException
Return the parameter values or null if it does not exist.

Parameters:
name - the value to get
Returns:
the parameter values
Throws:
java.lang.IllegalArgumentException - if the name is null

getMap

public java.util.Map getMap()
Return the a map containing the values. julien : should we return an immutable map or a map that checks that modifications are valid ?


clear

public void clear()
Clear all the parameters.


replace

public void replace(java.util.Map map)
Replace all the parameters.

Throws:
java.lang.IllegalArgumentException - if the map is not valid

replace

public void replace(Parameters parameters)
Replace all the parameters.

Throws:
java.lang.IllegalArgumentException - if the parameters is not valid

setValue

public void setValue(java.lang.String name,
                     java.lang.String value)
Set the a parameter value.

Parameters:
name - the parameter name
value - the parameter value
Throws:
java.lang.IllegalArgumentException - if the name is null
java.lang.IllegalArgumentException - if the value is null

setValues

public void setValues(java.lang.String name,
                      java.lang.String[] values)
Set the parameter values. This method does not make a defensive copy of the values.

Parameters:
name - the parameter name
values - the parameter values
Throws:
java.lang.IllegalArgumentException - if the name is null

remove

public void remove(java.lang.String name)
Remove a parameter.

Throws:
java.lang.IllegalArgumentException - if the name is null

getSize

public int getSize()
Return the size.


toString

public java.lang.String toString()

validateMap

protected void validateMap(java.util.Map map)
                    throws java.lang.IllegalArgumentException
Validate the parameter map. The map is considered valid if
  • it is not null
  • the key set contains only strings
  • the value set contains valid string arrays

Parameters:
map - the map to validate
Throws:
java.lang.IllegalArgumentException - if the map is not valid

validateStringArray

protected void validateStringArray(java.lang.String[] values)
                            throws java.lang.IllegalArgumentException
Validate the string array. The array is considered valid if
  • it is not null
  • the size is greater than zero
  • all the parameters are not null

Parameters:
values - the string array to validate
Throws:
java.lang.IllegalArgumentException - if the array is not valid