org.progeeks.tool.gen
Class CollectionGenerator
java.lang.Object
org.progeeks.tool.gen.BaseDataGenerator
org.progeeks.tool.gen.CollectionGenerator
- All Implemented Interfaces:
- DataGenerator
public class CollectionGenerator
- extends BaseDataGenerator
Creates a collection of objects. The number of items in the collection is determined by the
countGenerator
.countGenerator
must return an object of type
Integer with a value >= 0. The valueGenerator
creates the items to add to the
collection. The dataClass
is the type of collection to return. If
asArray
is set, the generator will return an array with elements of type
arrayClass
.
- Version:
- $Revision: 1.5 $
- Author:
- esword
Field Summary |
protected static Log |
log
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
protected static final Log log
CollectionGenerator
public CollectionGenerator()
generateRealData
protected java.lang.Object generateRealData(DataGeneratorContext context)
- Creates a collection of items. The collection itself is added to the context before the
valueGenerator is invoked.
- Specified by:
generateRealData
in class BaseDataGenerator
isDataValid
public boolean isDataValid(java.lang.Object testItem,
DataGeneratorContext context)
- Overrides
BaseDataGenerator
's implementation since the testItem could be an
array rather than a collection.
- Specified by:
isDataValid
in interface DataGenerator
- Overrides:
isDataValid
in class BaseDataGenerator
testData
protected boolean testData(java.lang.Object testItem,
DataGeneratorContext context)
- Description copied from class:
BaseDataGenerator
- Left for sub-classes. Subclasses do not have to check for null.
- Specified by:
testData
in class BaseDataGenerator
getCountGenerator
public DataGenerator getCountGenerator()
- Returns:
- Returns the countGenerator.
getValueGenerator
public DataGenerator getValueGenerator()
- Returns:
- Returns the valueGenerator.
setCountGenerator
public void setCountGenerator(DataGenerator countGenerator)
- Parameters:
countGenerator
- The countGenerator to set.
setValueGenerator
public void setValueGenerator(DataGenerator dataGenerator)
- Parameters:
valueGenerator
- The valueGenerator to set.
setDataClass
public void setDataClass(java.lang.String dataClass)
- Enforces that dataClass implement Collection
- Specified by:
setDataClass
in interface DataGenerator
- Overrides:
setDataClass
in class BaseDataGenerator
- Parameters:
dataClass
- The dataClass to set.
isAsArray
public boolean isAsArray()
- Returns:
- Returns the asArray.
setAsArray
public void setAsArray(boolean asArray)
- Parameters:
asArray
- The asArray to set.
getArrayClass
public java.lang.Class getArrayClass()
- Returns:
- Returns the arrayClass.
setArrayClass
public void setArrayClass(java.lang.Class arrayClass)
- Parameters:
arrayClass
- The arrayClass to set.
Copyright © 2002-2003 Paul Speed. All Rights Reserved.