org.apache.anteater.test
Class GroupUtils

java.lang.Object
  |
  +--org.apache.anteater.test.GroupUtils

public class GroupUtils
extends Object

Various static utility methods for manipulating lists of Properties and Namespaces.

Since:
July 6, 2002
Version:
$Revision: 1.3 $ $Date: 2002/10/17 13:17:41 $
Author:
Jeff Turner

Constructor Summary
GroupUtils()
           
 
Method Summary
static ArrayList getNamedUserProps(String groupId, ArrayList propList, org.apache.tools.ant.Project proj)
          Return a List of user properties (-Dfoo=bar, etc) whose names match those found in the specified list, in the specified group
static Namespace getNamespace(ArrayList nsList, String prefix)
          Retrieves the Namespace from the specified list.
static org.apache.tools.ant.taskdefs.Property getProperty(ArrayList propList, String name)
          Retrieves the Property from the specified list.
static org.apache.tools.ant.taskdefs.Property getUserProperty(String groupId, String propId, org.apache.tools.ant.Project proj)
          Retrieve a user property with a certain name and group from a Project
static ArrayList mergeNamespaces(ArrayList parents, ArrayList children)
          Do the 'merging' of two sets of properties, preferring the second set.
static ArrayList mergeProps(ArrayList parents, ArrayList children)
          Do the 'merging' of two sets of properties, preferring the second set.
static ArrayList mergeUses(ArrayList parents, ArrayList children)
          Merge two lists of Features (requirements).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupUtils

public GroupUtils()
Method Detail

mergeNamespaces

public static ArrayList mergeNamespaces(ArrayList parents,
                                        ArrayList children)
Do the 'merging' of two sets of properties, preferring the second set.

Parameters:
parents - Parent Group's Namespaces
children - Child Group's Namespaces
Returns:
A list containing a superset of properties from both lists. Where there was a conflict, the child's property is used.

mergeUses

public static ArrayList mergeUses(ArrayList parents,
                                  ArrayList children)
Merge two lists of Features (requirements).

Parameters:
parents - Parent Group's Features
children - Child Group's Features
Returns:
A list containing Features from both lists.

mergeProps

public static ArrayList mergeProps(ArrayList parents,
                                   ArrayList children)
Do the 'merging' of two sets of properties, preferring the second set.

Parameters:
parents - Parent Group's Properties
children - Child Group's Properties
Returns:
A list containing a superset of properties from both lists. Where there was a conflict, the child's property is used.

getNamedUserProps

public static ArrayList getNamedUserProps(String groupId,
                                          ArrayList propList,
                                          org.apache.tools.ant.Project proj)
Return a List of user properties (-Dfoo=bar, etc) whose names match those found in the specified list, in the specified group

Parameters:
groupId - Group of property, eg 'default'
propList - List of Properties, whose names will be searched for corresponding user properties.
proj - Project to search
Returns:
An ArrayList of user properties, with names corresponding to those in propList

getUserProperty

public static org.apache.tools.ant.taskdefs.Property getUserProperty(String groupId,
                                                                     String propId,
                                                                     org.apache.tools.ant.Project proj)
Retrieve a user property with a certain name and group from a Project

Parameters:
groupId - Group of property, eg 'default'
propId - Name of property, eg 'debug'
proj - Ant Project to search properties from
Returns:
Newly constructed Property housing the data read from the Project, or null if none was found

getProperty

public static org.apache.tools.ant.taskdefs.Property getProperty(ArrayList propList,
                                                                 String name)
Retrieves the Property from the specified list.

Parameters:
propList - The List of Properties
name - The name of the property to retrieve
Returns:
The Property, or null if not found.

getNamespace

public static Namespace getNamespace(ArrayList nsList,
                                     String prefix)
Retrieves the Namespace from the specified list.

Parameters:
nsList - The List of namespaces
prefix - The prefix of the namespace to retrieve
Returns:
The Namespace, or null if not found.


Ant Functional Tester -- see Project home page for details