org.progeeks.tool.gen
Class EqualsGenerator

java.lang.Object
  extended by org.progeeks.tool.gen.BaseDataGenerator
      extended by org.progeeks.tool.gen.EqualsGenerator
All Implemented Interfaces:
DataGenerator

public class EqualsGenerator
extends BaseDataGenerator

Restricts a property to exactly one value (and optionally null). If you want to force a field to be null, just use this class with no value set. A GroupMemberGenerator with a single item in its group offers the same functionality as this class. This class is just a bit easier to configure.

Version:
$Revision: 1.5 $
Author:
esword

Field Summary
protected static Log log
           
 
Fields inherited from class org.progeeks.tool.gen.BaseDataGenerator
allowNull, nullPercentage
 
Constructor Summary
EqualsGenerator()
           
 
Method Summary
protected  java.lang.Object generateRealData(DataGeneratorContext context)
          If the basis value does not match BaseDataGenerator.dataClassName but is a String, tries to create an object of the proper type from the basis.
 java.lang.Object getBasis()
           
 void setBasis(java.lang.Object basis)
           
protected  boolean testData(java.lang.Object testItem, DataGeneratorContext context)
          Check if given item is equal to basis.
 java.lang.String toString()
           
 
Methods inherited from class org.progeeks.tool.gen.BaseDataGenerator
generateData, getAllowNull, getDataClass, getDataClazz, getEnforceResolvable, getNullPercentage, isDataValid, setAllowNull, setDataClass, setEnforceResolvable, setNullPercentage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected static final Log log
Constructor Detail

EqualsGenerator

public EqualsGenerator()
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

testData

protected boolean testData(java.lang.Object testItem,
                           DataGeneratorContext context)
Check if given item is equal to basis. If not the same type and basis is a String, try to convert basis to the type of the test item and then compare.

Specified by:
testData in class BaseDataGenerator

generateRealData

protected java.lang.Object generateRealData(DataGeneratorContext context)
If the basis value does not match BaseDataGenerator.dataClassName but is a String, tries to create an object of the proper type from the basis.

Specified by:
generateRealData in class BaseDataGenerator

getBasis

public java.lang.Object getBasis()
Returns:
Returns the basis.

setBasis

public void setBasis(java.lang.Object basis)
Parameters:
basis - The basis to set.


Copyright © 2002-2003 Paul Speed. All Rights Reserved.