|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DataGenerator
Creates an object (regular POJO or MetaObject
) with the value of the object (or
its properties) set according to various rules. The most basic rule is whether the object can be
null or not. Implementing classes can add various rules depending on what type of data they are
supposed to generate. Examples include:
Collection
of objects
Callers can pass a context which contains information about the environment in which the object
is being created. For example, if the generator is being invoked to set a property of another
object, the context should contain the parent object. This is most useful for
ConditionalDataGenerators
that depend on the value of other properties or even
other objects.
Method Summary | |
---|---|
java.lang.Object |
generateData(DataGeneratorContext context)
Creates an object of the proper type. |
boolean |
getAllowNull()
|
java.lang.String |
getDataClass()
|
float |
getNullPercentage()
|
boolean |
isDataValid(java.lang.Object testItem,
DataGeneratorContext context)
Returns if the given object could be generated by this generator with its current rule settings. |
void |
setAllowNull(boolean allowNull)
|
void |
setDataClass(java.lang.String dataClass)
The full java class name or a MetaClass name of the objects to create |
void |
setNullPercentage(float nullPercentage)
|
Method Detail |
---|
java.lang.Object generateData(DataGeneratorContext context)
context
- boolean isDataValid(java.lang.Object testItem, DataGeneratorContext context)
testItem
- context
- java.lang.String getDataClass()
void setDataClass(java.lang.String dataClass)
dataClass
- The dataClass to set.boolean getAllowNull()
void setAllowNull(boolean allowNull)
allowNull
- The allowNull to set.float getNullPercentage()
void setNullPercentage(float nullPercentage)
nullPercentage
- The nullPercentage to set.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |