com.pega.pegarules.pub.runtime
Class ParameterPage

java.lang.Object
  extended by com.pega.pegarules.pub.runtime.ParameterPage
All Implemented Interfaces:
StringMap, java.util.Map

public class ParameterPage
extends java.lang.Object
implements StringMap

The ParameterPage class allows a collection of String-valued, named parameters to be shared easily and automatically during processing. Parameter names are subject to the same (character-set) limitations as ClipboardProperty names. Values may be specified directly or indirectly.

An indirect parameter identifies a scalar clipboard ClipboardProperty which holds the String value of the parameter. Resetting the value of the parameter will change the value of the ClipboardProperty associated with it.

Version:
$Revision: 31 $ $Date: 2009-06-24 09:38:04 -0400 (Wed, 24 Jun 2009) $
Author:
John van der Meer

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
static java.lang.String COPYRIGHT
           
static java.lang.String VERSION
           
 
Constructor Summary
ParameterPage()
           
 
Method Summary
 void clear()
          Removes all parameters from this instance.
 boolean containsKey(java.lang.Object aName)
          Identifies whether the named parameter is defined in this instance.
 boolean containsValue(java.lang.Object aValue)
          Identifies whether the specified value is associated with one or more parameter names in this instance.
 void copyParameter(java.lang.String aName, java.lang.String aNewName)
           
 ParameterPage copyValues()
          Make a copy of this ParameterPage.
 void define(java.lang.String aName, ClipboardProperty aProperty)
          Establishes an indirect parameter, associating the specified ClipboardProperty instance with the specified name.
 void define(java.lang.String aName, java.lang.Object aValue)
          Establishes a direct parameter with the specified name and value.
 void define(java.lang.String aName, java.lang.String aValue)
          Establishes a direct parameter with the specified name and value.
 java.util.Set entrySet()
          Returns a set view of the mappings contained in this instance.
 boolean equals(java.lang.Object aObject)
          Compares the specified object with this instance for equality.
 java.lang.Object get(java.lang.Object aName)
          Identifies the definition, if any, of the named parameter.
 com.pega.ibm.icu.math.BigDecimal getAsBigDecimal(java.lang.String aName)
          Returns the value, if any, of the named parameter.
 boolean getAsBoolean(java.lang.String aName)
          Identifies the value, if any, of the named parameter.
 java.util.Date getAsDate(java.lang.String aName)
          Returns the value, if any, of the named parameter on the current ParameterPage.
 double getAsDouble(java.lang.String aName)
          Identifies the value, if any, of the named parameter.
 int getAsInteger(java.lang.String aName)
          Identifies the value, if any, of the named parameter.
 java.lang.Object getDefinition(java.lang.String aName)
          Identifies the definition, if any, of the named parameter.
 java.lang.Object getObject(java.lang.String aName)
          Identifies the value, if any, of the named parameter.
 java.lang.Object getParameterValue(java.lang.String aName)
          Identifies the value, if any, of the named parameter.
 java.lang.String getString(java.lang.String aName)
          Identifies the value, if any, of the named parameter.
 int hashCode()
          Returns the hash code value for this instance, which will be the hashCode value of the underlying java.util.HashMap.
 boolean isDefined(java.lang.String aName)
          Identifies whether the named parameter is defined in this instance.
 boolean isEmpty()
          Inicates whether this map contains no name-value associations.
 java.util.Set keySet()
          Returns a set view of the keys (names) contained in this instance.
 java.lang.Object put(java.lang.Object aName, java.lang.Object aValue)
          Associates the specified value with the specified name in this instance, provided that the name is a String instance.
 void putAll(java.util.Map aMap)
          Copies all of the mappings from the specified map to this map.
 void putObject(java.lang.String aName, java.lang.Object aValue)
          Assigns the specified value to the named parameter.
 void putObject(java.lang.String aName, java.lang.Object aValue, boolean aSkipValidName)
          Deprecated. Use putObject(String aName, Object aValue) instead
 void putParamValue(java.lang.String aName, char aType, com.pega.ibm.icu.math.BigDecimal aValue)
          Assigns the specified value to the named parameter.
 void putParamValue(java.lang.String aName, char aType, boolean aValue)
          Assigns the specified value to the named parameter.
 void putParamValue(java.lang.String aName, char aType, java.util.Date aValue)
          Assigns the specified value to the named parameter.
 void putParamValue(java.lang.String aName, char aType, double aValue)
          Assigns the specified value to the named parameter.
 void putParamValue(java.lang.String aName, char aType, int aValue)
          Assigns the specified value to the named parameter.
 void putParamValue(java.lang.String aName, char aType, java.lang.Object aValue)
          Assigns the specified value to the named parameter.
 void putParamValue(java.lang.String aName, char aType, java.lang.String aValue)
          Assigns the specified value to the named parameter.
 void putParamValue(java.lang.String aName, java.lang.String aValue)
          Assigns the specified value to the named parameter.
 void putString(java.lang.String aName, java.lang.String aValue)
          Assigns the specified value to the named parameter.
 java.lang.Object remove(java.lang.Object aName)
          Removes any association for this name from this instance.
 void remove(java.lang.String aName)
          Removes the named parameter, if any, from this instance.
 int size()
          Returns the number of name-value mappings in this instance.
 java.lang.String toString()
          Returns a string representation of the key/value pairs in this StringMap object.
static boolean validName(java.lang.String aName)
          Check if a string would be a valid property name.
 java.util.Collection values()
          Returns a collection view of the values contained in this instance.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
See Also:
Constant Field Values

VERSION

public static final java.lang.String VERSION
Constructor Detail

ParameterPage

public ParameterPage()
Method Detail

clear

public void clear()
Removes all parameters from this instance.

Specified by:
clear in interface java.util.Map

isDefined

public boolean isDefined(java.lang.String aName)
Identifies whether the named parameter is defined in this instance.

Parameters:
aName - parameter whose presence is to be tested
Returns:
true when this instance includes the named parameter

copyParameter

public void copyParameter(java.lang.String aName,
                          java.lang.String aNewName)

define

public void define(java.lang.String aName,
                   java.lang.String aValue)
Establishes a direct parameter with the specified name and value. This method differs in effect from putString only when the named parameter is previously defined as indirect: the definition will be replaced, leaving unchanged the value of the ClipboardProperty that was associated with the parameter.

Parameters:
aName - name of parameter to be defined
aValue - value to be assigned to the named parameter. An empty String will be used if the value is null.
Throws:
java.lang.IllegalArgumentException - if the parameter name is not valid

define

public void define(java.lang.String aName,
                   java.lang.Object aValue)
Establishes a direct parameter with the specified name and value. This method differs in effect from putObject only when the named parameter is previously defined as indirect: the definition will be replaced, leaving unchanged the value of the ClipboardProperty that was associated with the parameter.

Parameters:
aName - name of parameter to be defined
aValue - value to be assigned to the named parameter.
Throws:
java.lang.IllegalArgumentException - if the parameter name is not valid

define

public void define(java.lang.String aName,
                   ClipboardProperty aProperty)
Establishes an indirect parameter, associating the specified ClipboardProperty instance with the specified name.

Parameters:
aName - name of parameter to be defined
aProperty - scalar ClipboardProperty instance that holds the value of the named parameter
Throws:
java.lang.IllegalArgumentException - if the parameter name is not valid, or if the specified ClipboardProperty is not defined or not a string or Java Object

getDefinition

public java.lang.Object getDefinition(java.lang.String aName)
Identifies the definition, if any, of the named parameter.

Parameters:
aName - parameter whose definition is to be returned
Returns:
definition of the named parameter
  • String value of parameter defined as a direct string
  • ClipboardProperty instance associated with parameter defined as indirect
  • Object value of parameter defined as a direct Java Object
  • null if this parameter is not defined

getString

public java.lang.String getString(java.lang.String aName)
Identifies the value, if any, of the named parameter.

Specified by:
getString in interface StringMap
Parameters:
aName - parameter whose value is to be returned
Returns:
String value associated with the named parameter, or null if this parameter is not defined

getParameterValue

public java.lang.Object getParameterValue(java.lang.String aName)
Identifies the value, if any, of the named parameter. This method is useful if the mode of the parameter (String vs. Java Object) is unknown.

Parameters:
aName - parameter whose value is to be returned
Returns:
object value associated with the named parameter, or null if this parameter is not defined

getAsBigDecimal

public com.pega.ibm.icu.math.BigDecimal getAsBigDecimal(java.lang.String aName)
Returns the value, if any, of the named parameter.

Use of PublicAPI.getParamAsBigDecimal is preferred.

Parameters:
aName - parameter whose value is to be returned
Returns:
value of the named parameter, or BigDecimal.ZERO if this parameter is not defined
Throws:
java.lang.NullPointerException - if there is no current ParameterPage

getAsDate

public java.util.Date getAsDate(java.lang.String aName)
Returns the value, if any, of the named parameter on the current ParameterPage.

Parameters:
aName - parameter whose value is to be returned
Returns:
value of the named parameter, or Date(0) if this parameter is not defined
Throws:
java.lang.NullPointerException - if there is no current ParameterPage

getAsInteger

public int getAsInteger(java.lang.String aName)
Identifies the value, if any, of the named parameter.

Use of PublicAPI.getParamAsInteger is preferred.

Parameters:
aName - parameter whose value is to be returned
Returns:
int value associated with the named parameter, or 0 if this parameter is not defined

getAsDouble

public double getAsDouble(java.lang.String aName)
Identifies the value, if any, of the named parameter.

Use of PublicAPI.getParamAsDouble is preferred.

Parameters:
aName - parameter whose value is to be returned
Returns:
double value associated with the named parameter, or 0 if this parameter is not defined

getAsBoolean

public boolean getAsBoolean(java.lang.String aName)
Identifies the value, if any, of the named parameter.

Use of PublicAPI.getParamAsBoolean is preferred.

Parameters:
aName - parameter whose value is to be returned
Returns:
boolean value associated with the named parameter, or false if this parameter is not defined

getObject

public java.lang.Object getObject(java.lang.String aName)
Identifies the value, if any, of the named parameter.

Parameters:
aName - parameter whose value is to be returned
Returns:
Object value associated with the named parameter, or null if this parameter is not defined

putString

public void putString(java.lang.String aName,
                      java.lang.String aValue)
Assigns the specified value to the named parameter. If the parameter was not previously defined, it will be defined as direct. If the parameter was defined as indirect, the ClipboardProperty associated with it will be modified.

Specified by:
putString in interface StringMap
Parameters:
aName - parameter to receive the specified value
aValue - value to be assigned to the named parameter. An empty String will be used if the value is null.
Throws:
java.lang.IllegalArgumentException - if the parameter name is not valid
java.lang.NullPointerException - if the parameter name is null

putObject

public void putObject(java.lang.String aName,
                      java.lang.Object aValue)
Assigns the specified value to the named parameter. If the parameter was not previously defined, it will be defined as direct. If the parameter was defined as indirect, the ClipboardProperty associated with it will be modified.

Parameters:
aName - parameter to receive the specified value
aValue - value to be assigned to the named parameter.
Throws:
java.lang.IllegalArgumentException - if the parameter name is not valid
java.lang.NullPointerException - if the parameter name is null

putObject

public void putObject(java.lang.String aName,
                      java.lang.Object aValue,
                      boolean aSkipValidName)
Deprecated. Use putObject(String aName, Object aValue) instead

Assigns the specified value to the named parameter. If the parameter was not previously defined, it will be defined as direct. If the parameter was defined as indirect, the ClipboardProperty associated with it will be modified.

Parameters:
aName - parameter to receive the specified value
aValue - value to be assigned to the named parameter.
aSkipValidName - Avoid check of aName for valid characters
Throws:
java.lang.IllegalArgumentException - if the parameter name is not valid
java.lang.NullPointerException - if the parameter name is null

putParamValue

public void putParamValue(java.lang.String aName,
                          char aType,
                          com.pega.ibm.icu.math.BigDecimal aValue)
Assigns the specified value to the named parameter.

Parameters:
aName - parameter to receive the specified value
aType - declared PropertyInfo type code for the parameter
aValue - value to be assigned to the named parameter.

putParamValue

public void putParamValue(java.lang.String aName,
                          char aType,
                          boolean aValue)
Assigns the specified value to the named parameter.

Parameters:
aName - parameter to receive the specified value
aType - declared PropertyInfo type code for the parameter
aValue - value to be assigned to the named parameter.

putParamValue

public void putParamValue(java.lang.String aName,
                          char aType,
                          java.util.Date aValue)
Assigns the specified value to the named parameter.

Parameters:
aName - parameter to receive the specified value
aType - declared PropertyInfo type code for the parameter
aValue - value to be assigned to the named parameter.

putParamValue

public void putParamValue(java.lang.String aName,
                          char aType,
                          double aValue)
Assigns the specified value to the named parameter.

Parameters:
aName - parameter to receive the specified value
aType - declared PropertyInfo type code for the parameter
aValue - value to be assigned to the named parameter.

putParamValue

public void putParamValue(java.lang.String aName,
                          char aType,
                          int aValue)
Assigns the specified value to the named parameter.

Parameters:
aName - parameter to receive the specified value
aType - declared PropertyInfo type code for the parameter
aValue - value to be assigned to the named parameter.

putParamValue

public void putParamValue(java.lang.String aName,
                          char aType,
                          java.lang.Object aValue)
Assigns the specified value to the named parameter.

Parameters:
aName - parameter to receive the specified value
aType - declared PropertyInfo type code for the parameter (ignored)
aValue - value to be assigned to the named parameter.

putParamValue

public void putParamValue(java.lang.String aName,
                          char aType,
                          java.lang.String aValue)
Assigns the specified value to the named parameter.

Parameters:
aName - parameter to receive the specified value
aType - declared PropertyInfo type code for the parameter (ignored)
aValue - value to be assigned to the named parameter. An empty String will be used if the value is null.

putParamValue

public void putParamValue(java.lang.String aName,
                          java.lang.String aValue)
Assigns the specified value to the named parameter. If the parameter was not previously defined, it will be defined as direct. If the parameter was defined as indirect, the ClipboardProperty associated with it will be modified.

Parameters:
aName - parameter to receive the specified value
aValue - value to be assigned to the named parameter. An empty String will be used if the value is null.
Throws:
java.lang.IllegalArgumentException - if the parameter name is not valid
java.lang.NullPointerException - if the parameter name is null

remove

public void remove(java.lang.String aName)
Removes the named parameter, if any, from this instance.

Parameters:
aName - name to be removed from this instance

copyValues

public ParameterPage copyValues()
Make a copy of this ParameterPage. Indirect entries (ClipboardProperties) will have their values copied into a new direct entry in the returned ParameterPage.

Returns:
a copy of this ParameterPage

containsKey

public boolean containsKey(java.lang.Object aName)
Identifies whether the named parameter is defined in this instance.

Specified by:
containsKey in interface java.util.Map
Parameters:
aName - parameter whose presence is to be tested
Returns:
true when this instance includes the named parameter

containsValue

public boolean containsValue(java.lang.Object aValue)
Identifies whether the specified value is associated with one or more parameter names in this instance.

Specified by:
containsValue in interface java.util.Map
Parameters:
aValue - value whose presence is to be tested
Returns:
true when this instance associates this value with at least one name

entrySet

public java.util.Set entrySet()
Returns a set view of the mappings contained in this instance.

Specified by:
entrySet in interface java.util.Map
Returns:
a set view of the mappings in this instance

equals

public boolean equals(java.lang.Object aObject)
Compares the specified object with this instance for equality.

Specified by:
equals in interface java.util.Map
Overrides:
equals in class java.lang.Object
Parameters:
aObject -
Returns:
true when this instance is equial to the specified object

get

public java.lang.Object get(java.lang.Object aName)
Identifies the definition, if any, of the named parameter.

Specified by:
get in interface java.util.Map
Parameters:
aName - parameter whose definition is to be returned
Returns:
definition of the named parameter
  • String value of parameter defined as direct
  • ClipboardProperty instance associated with parameter defined as indirect
  • null if this parameter is not defined
See Also:
getDefinition(String)

hashCode

public int hashCode()
Returns the hash code value for this instance, which will be the hashCode value of the underlying java.util.HashMap.

Specified by:
hashCode in interface java.util.Map
Overrides:
hashCode in class java.lang.Object
Returns:
the hash code value for this instance

isEmpty

public boolean isEmpty()
Inicates whether this map contains no name-value associations.

Specified by:
isEmpty in interface java.util.Map
Returns:
true when this instance contains no name-value associations

keySet

public java.util.Set keySet()
Returns a set view of the keys (names) contained in this instance.

Specified by:
keySet in interface java.util.Map
Returns:
a set view of the keys in this instance

put

public java.lang.Object put(java.lang.Object aName,
                            java.lang.Object aValue)
Associates the specified value with the specified name in this instance, provided that the name is a String instance. Any previous association for this name is replaced.

Specified by:
put in interface java.util.Map
Parameters:
aName - name with which the specified value is to be associated
aValue - value to be assigned to the named parameter.
Returns:
previous association for this name, or null if there was none
Throws:
java.lang.ClassCastException - if aName isn't a String
java.lang.IllegalArgumentException - if the parameter name is not valid
java.lang.NullPointerException - if the parameter name is null

putAll

public void putAll(java.util.Map aMap)
Copies all of the mappings from the specified map to this map.

Specified by:
putAll in interface java.util.Map
Parameters:
aMap - the map to be copied
Throws:
java.lang.UnsupportedOperationException - if the map is not an instance of ParameterPage

remove

public java.lang.Object remove(java.lang.Object aName)
Removes any association for this name from this instance.

Specified by:
remove in interface java.util.Map
Parameters:
aName - name to be removed from this instance
Returns:
previous association for this name, or null if there was none

size

public int size()
Returns the number of name-value mappings in this instance.

Specified by:
size in interface java.util.Map
Returns:
number of mappings

validName

public static boolean validName(java.lang.String aName)
Check if a string would be a valid property name. Valid names consist of numbers, letters, and the '_' (underscore) character only. The first character must be a letter.

Parameters:
aName - Potential property name.
Returns:
true if this is a valid property name, false otherwise.

values

public java.util.Collection values()
Returns a collection view of the values contained in this instance.

Specified by:
values in interface java.util.Map
Returns:
a collection view of the values in this instance

toString

public java.lang.String toString()
Description copied from interface: StringMap
Returns a string representation of the key/value pairs in this StringMap object.

Specified by:
toString in interface StringMap
Overrides:
toString in class java.lang.Object
Returns:
String The string representation of this map.


Copyright © 2012 Pegasystems Inc. All Rights Reserved.