|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.progeeks.tool.gen.BaseDataGenerator
public abstract class BaseDataGenerator
Base class for other data generators. Handles generation of and testing for nulls when
null is an allowed value. Also checks that objects passed to isDataValid
are of
the same type as dataClass
if dataClass
can be resolved into a regular
class (i.e. it's not a MetaClass).
Field Summary | |
---|---|
protected boolean |
allowNull
|
protected static Log |
log
|
protected float |
nullPercentage
|
Constructor Summary | |
---|---|
BaseDataGenerator()
|
Method Summary | |
---|---|
java.lang.Object |
generateData(DataGeneratorContext context)
Handles null generation case. |
protected abstract java.lang.Object |
generateRealData(DataGeneratorContext context)
Left for sub-classes. |
boolean |
getAllowNull()
|
java.lang.String |
getDataClass()
|
java.lang.Class |
getDataClazz()
|
protected boolean |
getEnforceResolvable()
|
float |
getNullPercentage()
|
boolean |
isDataValid(java.lang.Object testItem,
DataGeneratorContext context)
Handles check for if testItem is null and if that is allowed. |
void |
setAllowNull(boolean allowNull)
|
void |
setDataClass(java.lang.String dataClass)
The full java class name or a MetaClass name of the objects to create |
protected void |
setEnforceResolvable(boolean enforceKnownClass)
Enforce that the dataClassName should be resolvable (i.e. is a known Java class). |
void |
setNullPercentage(float nullPercentage)
|
protected abstract boolean |
testData(java.lang.Object testItem,
DataGeneratorContext context)
Left for sub-classes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final Log log
protected boolean allowNull
protected float nullPercentage
Constructor Detail |
---|
public BaseDataGenerator()
Method Detail |
---|
public java.lang.Object generateData(DataGeneratorContext context)
generateRealData(DataGeneratorContext)
.
generateData
in interface DataGenerator
protected abstract java.lang.Object generateRealData(DataGeneratorContext context)
public boolean isDataValid(java.lang.Object testItem, DataGeneratorContext context)
testItem
is null and if that is allowed. Also check if it
is of the proper class (if possible). If those succeed, invokes sub-classes
testData
.
isDataValid
in interface DataGenerator
protected abstract boolean testData(java.lang.Object testItem, DataGeneratorContext context)
public java.lang.String getDataClass()
getDataClass
in interface DataGenerator
public void setDataClass(java.lang.String dataClass)
setDataClass
in interface DataGenerator
dataClass
- The dataClass to set.public java.lang.Class getDataClazz()
public boolean getAllowNull()
getAllowNull
in interface DataGenerator
public void setAllowNull(boolean allowNull)
setAllowNull
in interface DataGenerator
allowNull
- The allowNull to set.public float getNullPercentage()
getNullPercentage
in interface DataGenerator
public void setNullPercentage(float nullPercentage)
setNullPercentage
in interface DataGenerator
nullPercentage
- The nullPercentage to set.protected boolean getEnforceResolvable()
protected void setEnforceResolvable(boolean enforceKnownClass)
true
enforceKnownClass
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |