org.databene.benerator.composite
Class SourceAwareGenerator<E>

java.lang.Object
  extended by org.databene.benerator.util.AbstractGenerator<P>
      extended by org.databene.benerator.wrapper.GeneratorWrapper<E,E>
          extended by org.databene.benerator.wrapper.GeneratorProxy<E>
              extended by org.databene.benerator.composite.SourceAwareGenerator<E>
All Implemented Interfaces:
java.io.Closeable, Generator<E>, org.databene.commons.MessageHolder, org.databene.commons.Resettable, org.databene.commons.ThreadAware

public class SourceAwareGenerator<E>
extends GeneratorProxy<E>
implements org.databene.commons.MessageHolder

Generator proxy that combines a 'source' entity generator with variable support and ComponentBuilders.

Created: 29.08.2010 09:59:03

Since:
0.6.4
Author:
Volker Bergmann

Field Summary
 
Fields inherited from class org.databene.benerator.wrapper.GeneratorProxy
generatedType
 
Fields inherited from class org.databene.benerator.util.AbstractGenerator
context, logger, state
 
Constructor Summary
SourceAwareGenerator(java.lang.String instanceName, Generator<E> source, java.util.List<GeneratorComponent<E>> components, BeneratorContext context)
           
 
Method Summary
 void close()
          Closes the generator.
 ProductWrapper<E> generate(ProductWrapper<E> wrapper)
          Returns an instance of the generic type E, using the ProductWrapper instance provided as argument.
 java.lang.String getMessage()
           
 void init(GeneratorContext context)
           
 boolean isParallelizable()
           
 boolean isThreadSafe()
           
 void reset()
           
 java.lang.String toString()
           
 
Methods inherited from class org.databene.benerator.wrapper.GeneratorProxy
getGeneratedType
 
Methods inherited from class org.databene.benerator.wrapper.GeneratorWrapper
equals, generateFromSource, getSource, getSourceWrapper, hashCode, setSource
 
Methods inherited from class org.databene.benerator.util.AbstractGenerator
assertInitialized, assertNotInitialized, getResultWrapper, wasInitialized
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SourceAwareGenerator

public SourceAwareGenerator(java.lang.String instanceName,
                            Generator<E> source,
                            java.util.List<GeneratorComponent<E>> components,
                            BeneratorContext context)
Parameters:
source - another Generator of entities that serves as Entity builder. It may construct empty Entities or may import them (so this may overwrite imported attributes).
instanceName - instance name for the generated entities.
Method Detail

init

public void init(GeneratorContext context)
Specified by:
init in interface Generator<E>
Overrides:
init in class GeneratorWrapper<E,E>

generate

public ProductWrapper<E> generate(ProductWrapper<E> wrapper)
Description copied from interface: Generator
Returns an instance of the generic type E, using the ProductWrapper instance provided as argument. The wrapper may wrap a null value as a regular generator product. If the generator is not available (any more), it returns null instead of the ProductWrapper instance.

Specified by:
generate in interface Generator<E>
Overrides:
generate in class GeneratorProxy<E>

reset

public void reset()
Specified by:
reset in interface org.databene.commons.Resettable
Overrides:
reset in class GeneratorWrapper<E,E>

close

public void close()
Description copied from interface: Generator
Closes the generator. After invocation the state is unavailable.

Specified by:
close in interface java.io.Closeable
Specified by:
close in interface Generator<E>
Overrides:
close in class GeneratorWrapper<E,E>

getMessage

public java.lang.String getMessage()
Specified by:
getMessage in interface org.databene.commons.MessageHolder

toString

public java.lang.String toString()
Overrides:
toString in class GeneratorProxy<E>

isParallelizable

public boolean isParallelizable()
Specified by:
isParallelizable in interface org.databene.commons.ThreadAware
Overrides:
isParallelizable in class GeneratorWrapper<E,E>

isThreadSafe

public boolean isThreadSafe()
Specified by:
isThreadSafe in interface org.databene.commons.ThreadAware
Overrides:
isThreadSafe in class GeneratorWrapper<E,E>


Copyright © 2013. All Rights Reserved.