com.ail.core.configure
Class Group

java.lang.Object
  extended by com.ail.core.Type
      extended by com.ail.core.configure.Component
          extended by com.ail.core.configure.Group
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
Builder, Builders, Configuration, Type, Types

public class Group
extends Component

A Group simply provides a container to give the Configuration file more structure. It allows parameters to be grouped into sections. For example: <Configuration> ... <Group name="GroupName"> <Parameter name="myParam" value="a value"/> <Parameter name="myOtherParam" value="another value"/> </Group> ... </Configuration> Note: A group may contain subgroups.

Version:
$Revision: 1.4 $
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.ail.core.Type
jXPathContext, NOT_PERSISTED
 
Constructor Summary
Group()
          Default constructor.
 
Method Summary
 void addGroup(Group vGroup)
          Add a Parameter group to this group.
 void addParameter(Parameter vParameter)
          Add a Parameter to this group.
 Group findGroup(java.lang.String groupName)
          Find a group using a dot seperated group name.
 Parameter findParameter(java.lang.String paramNameArg)
          Find a nested parameter in this configuration.
 java.lang.String findParameterValue(java.lang.String paramName)
          Find the value of a parameter.
 java.lang.String findParameterValue(java.lang.String paramName, java.lang.String defaultValue)
          Return the value of a parameter, or a default value if the parameter is undefined.
 java.util.List<Group> getGroup()
          Return a list of the groups in the group as an array.
 Group getGroup(int index)
          Fetch a specific group by it's index in the group.
 int getGroupCount()
          Fetch a count of the number of groups in this group.
 java.util.List<Parameter> getParameter()
          Return a list of the parameters in the group as a List.
 Parameter getParameter(int index)
          Fetch a specific Parameter by it's index in the group.
 int getParameterCount()
          Fetch a count of the number of properties in this group.
 void removeAllGroup()
          Remove (delete) all the groups in this group.
 void removeAllParameter()
          Remove (delete) all the properties in this group.
 Group removeGroup(int index)
          Remove (delete) a specific group from this group.
 Parameter removeParameter(int index)
          Remove (delete) a specific Parameter from this group.
 void setGroup(int index, Group vGroup)
          Set the group at a specified index in this group, this replaces the group currently at that index.
 void setGroup(java.util.List<Group> group)
          Replace all the groups in the group with those in the array provided.
 void setParameter(java.util.List<Parameter> parameter)
          Replace all the properties in the group with those in the list provided.
 void setParameterAt(int index, Parameter vParameter)
          Set the Parameter at a specified index in this group, this replaces the Parameter currently at that index.
 
Methods inherited from class com.ail.core.configure.Component
getName, getNameLowerCase, setName
 
Methods inherited from class com.ail.core.Type
addAttribute, clone, deleteLock, deleteSerialVersion, fetchJXPathContext, getAttribute, getAttribute, getAttributeCount, getForeignSystemId, getLock, getSerialVersion, getSystemId, hasLock, hasSerialVersion, hasSystemId, isPersisted, markAsNotPersisted, mergeWithDataFrom, removeAttribute, removeAttribute, setAttribute, setForeignSystemId, setLock, setSerialVersion, setSystemId, xpathGet, xpathGet, xpathIterate, xpathSet
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Group

public Group()
Default constructor.

Method Detail

addParameter

public void addParameter(Parameter vParameter)
                  throws java.lang.IndexOutOfBoundsException
Add a Parameter to this group.

Parameters:
vParameter - Parameter to add.
Throws:
java.lang.IndexOutOfBoundsException - Group is "full"

getParameter

public Parameter getParameter(int index)
                       throws java.lang.IndexOutOfBoundsException
Fetch a specific Parameter by it's index in the group.

Parameters:
index - Index of Parameter to fetch.
Returns:
The Parameter at 'index'.
Throws:
java.lang.IndexOutOfBoundsException - index is out of range

getParameter

public java.util.List<Parameter> getParameter()
Return a list of the parameters in the group as a List.

Returns:
List of parameters.

getParameterCount

public int getParameterCount()
Fetch a count of the number of properties in this group. This does not include the properties in sub-groups.

Returns:
Count of properties in the group.

removeAllParameter

public void removeAllParameter()
Remove (delete) all the properties in this group. This does not effect sub-groups.


removeParameter

public Parameter removeParameter(int index)
Remove (delete) a specific Parameter from this group.

Parameters:
index - The index of the Parameter to remove.
Returns:
removed Parameter, or null if index is out of range.

setParameterAt

public void setParameterAt(int index,
                           Parameter vParameter)
                    throws java.lang.IndexOutOfBoundsException
Set the Parameter at a specified index in this group, this replaces the Parameter currently at that index.

Parameters:
index - Index into the group
vParameter - Parameter to be added.
Throws:
java.lang.IndexOutOfBoundsException - If index is out of range.

setParameter

public void setParameter(java.util.List<Parameter> parameter)
Replace all the properties in the group with those in the list provided.

Parameters:
parameter - List of parameters

addGroup

public void addGroup(Group vGroup)
              throws java.lang.IndexOutOfBoundsException
Add a Parameter group to this group.

Parameters:
vGroup - Group to add.
Throws:
java.lang.IndexOutOfBoundsException - Group is "full"

getGroup

public Group getGroup(int index)
               throws java.lang.IndexOutOfBoundsException
Fetch a specific group by it's index in the group.

Parameters:
index - Index of Parameter group to fetch.
Returns:
The group at 'index'.
Throws:
java.lang.IndexOutOfBoundsException - index is out of range

getGroup

public java.util.List<Group> getGroup()
Return a list of the groups in the group as an array.

Returns:
Array of groups.

getGroupCount

public int getGroupCount()
Fetch a count of the number of groups in this group. This does not include the Parameter groups in sub-groups.

Returns:
Count of Parameter groups in the group.

removeAllGroup

public void removeAllGroup()
Remove (delete) all the groups in this group. This does not effect sub-groups.


removeGroup

public Group removeGroup(int index)
Remove (delete) a specific group from this group.

Parameters:
index - The index of the group to remove.
Returns:
removed Group, or null if index is out of range.

setGroup

public void setGroup(int index,
                     Group vGroup)
              throws java.lang.IndexOutOfBoundsException
Set the group at a specified index in this group, this replaces the group currently at that index.

Parameters:
index - Index into the group
vGroup - Group to be added.
Throws:
java.lang.IndexOutOfBoundsException - If index is out of range.

setGroup

public void setGroup(java.util.List<Group> group)
Replace all the groups in the group with those in the array provided.

Parameters:
group - Array of groups

findGroup

public Group findGroup(java.lang.String groupName)
Find a group using a dot seperated group name. This method will search down throught the group layers of this configuration to locate a group with the nested group name specified.

Parameters:
groupName - Dot seperated group name (e.g. one.two.three).
Returns:
The located group, or null if it cannot be found.

findParameter

public Parameter findParameter(java.lang.String paramNameArg)
Find a nested parameter in this configuration. This method will search throught the group structure to find the named parameter.

Parameters:
paramNameArg - Nested name (e.g. outter.inner.parameter).
Returns:
The located parameter, or null if it cannot be found.

findParameterValue

public java.lang.String findParameterValue(java.lang.String paramName)
Find the value of a parameter.

Parameters:
paramName - The parameter to return the value of.
Returns:
The value of the parameter, or null if it is undefined.

findParameterValue

public java.lang.String findParameterValue(java.lang.String paramName,
                                           java.lang.String defaultValue)
Return the value of a parameter, or a default value if the parameter is undefined.

Parameters:
paramName - The parameter to return the value of.
defaultValue - The default value.
Returns:
The value of the parameter or the default value.