org.progeeks.tool.gen
Interface DataGenerator

All Known Implementing Classes:
BaseDataGenerator, BooleanGenerator, CollectionGenerator, ComplexObjectGenerator, ConditionalGenerator, DateGenerator, EqualsGenerator, GenGroupGenerator, GroupMemberGenerator, MapGenerator, NumberGenerator, SeriesGenerator, StringGenerator, StringListGenerator

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:

  • One and only one specific object
  • A number (of a designated type) in a specified range
  • An element of a specified group of objects
  • An object with some or all of its properties set by sub-generators
  • A 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.

    Version:
    $Revision: 1.3 $
    Author:
    esword

    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

    generateData

    java.lang.Object generateData(DataGeneratorContext context)
    Creates an object of the proper type.

    Parameters:
    context -

    isDataValid

    boolean isDataValid(java.lang.Object testItem,
                        DataGeneratorContext context)
    Returns if the given object could be generated by this generator with its current rule settings.

    Parameters:
    testItem -
    context -

    getDataClass

    java.lang.String getDataClass()
    Returns:
    Returns the dataClass.

    setDataClass

    void setDataClass(java.lang.String dataClass)
    The full java class name or a MetaClass name of the objects to create

    Parameters:
    dataClass - The dataClass to set.

    getAllowNull

    boolean getAllowNull()
    Returns:
    Returns the allowNull.

    setAllowNull

    void setAllowNull(boolean allowNull)
    Parameters:
    allowNull - The allowNull to set.

    getNullPercentage

    float getNullPercentage()
    Returns:
    Returns the nullPercentage.

    setNullPercentage

    void setNullPercentage(float nullPercentage)
    Parameters:
    nullPercentage - The nullPercentage to set.


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