com.bm.datagen
Class DataGenerator

java.lang.Object
  extended by com.bm.datagen.DataGenerator

public class DataGenerator
extends java.lang.Object

This is the base class for generating data. All custom generators are registered here dynamically

Author:
Daniel Wiese

Constructor Summary
DataGenerator(javax.persistence.EntityManager em)
           
 
Method Summary
 void cleanup()
          This method should be called every time before an entity creation task > this method tells every generator to call his cleanup method (annotation).
<T> java.lang.Object
getNextValue(Property property, Introspector<T> introspector, java.lang.Object instance)
          Return the value form the generator.
 void prepare()
          This method should be called every time before an entity creation task > this method tells every generator to call his prepare method(annotation).
 void registerGen(Generator<?> toRegister)
          Register one generator to the set of generators.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataGenerator

public DataGenerator(javax.persistence.EntityManager em)
Method Detail

registerGen

public void registerGen(Generator<?> toRegister)
Register one generator to the set of generators.

Parameters:
toRegister - - the generator to register

prepare

public void prepare()
This method should be called every time before an entity creation task > this method tells every generator to call his prepare method(annotation).


cleanup

public void cleanup()
This method should be called every time before an entity creation task > this method tells every generator to call his cleanup method (annotation).


getNextValue

public <T> java.lang.Object getNextValue(Property property,
                                         Introspector<T> introspector,
                                         java.lang.Object instance)
Return the value form the generator.

Type Parameters:
T - - the type of the bean
Parameters:
em - the entity manager
property - - the field/property for what the value should be generated
introspector - - the current introspector (belonging to the class with the field)
instance - - the current instance
Returns:
- the new generated value


Copyright © 2008. All Rights Reserved.