org.databene.benerator.wrapper
Class MessageGenerator

java.lang.Object
  extended by org.databene.benerator.util.AbstractGenerator<P>
      extended by org.databene.benerator.util.ValidatingGenerator<java.lang.String>
          extended by org.databene.benerator.wrapper.MessageGenerator
All Implemented Interfaces:
java.io.Closeable, Generator<java.lang.String>, Resettable, ThreadAware

public class MessageGenerator
extends ValidatingGenerator<java.lang.String>

Assembles the output of several source generators by a java.text.MessageFormat.

Created: 08.06.2006 21:48:08

Since:
0.1
Author:
Volker Bergmann

Field Summary
 
Fields inherited from class org.databene.benerator.util.ValidatingGenerator
ERROR_THRESHOLD, validator, WARNING_THRESHOLD
 
Fields inherited from class org.databene.benerator.util.AbstractGenerator
context, state
 
Constructor Summary
MessageGenerator()
          Sets minLength to 0, maxLength to 30 and all other values empty.
MessageGenerator(java.lang.String pattern, Generator<?>... sources)
           
MessageGenerator(java.lang.String pattern, int minLength, int maxLength, Generator... sources)
          Initializes Generator
 
Method Summary
 void close()
          Closes the generator.
 java.lang.String generateImpl()
          Implementation of ValidatingGenerator's generation callback method
 java.lang.Class<java.lang.String> getGeneratedType()
          Declares the type of the objects returned by the generate() method.
 int getMaxLength()
           
 int getMinLength()
           
 java.lang.String getPattern()
          Returns the pattern property
 void init(GeneratorContext context)
          ensures consistency of the generator's state
 boolean isParallelizable()
           
 boolean isThreadSafe()
           
 void reset()
           
 void setMaxLength(int maxLength)
           
 void setMinLength(int minLength)
           
 void setPattern(java.lang.String pattern)
          Sets the pattern property
 void setSources(Generator[] sources)
          Sets the source generators
 java.lang.String toString()
          Returns a String representation of the generator
 
Methods inherited from class org.databene.benerator.util.ValidatingGenerator
generate
 
Methods inherited from class org.databene.benerator.util.AbstractGenerator
assertInitialized, assertNotInitialized, wasInitialized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MessageGenerator

public MessageGenerator()
Sets minLength to 0, maxLength to 30 and all other values empty.


MessageGenerator

public MessageGenerator(java.lang.String pattern,
                        Generator<?>... sources)

MessageGenerator

public MessageGenerator(java.lang.String pattern,
                        int minLength,
                        int maxLength,
                        Generator... sources)
Initializes Generator

Method Detail

getPattern

public java.lang.String getPattern()
Returns the pattern property


setPattern

public void setPattern(java.lang.String pattern)
Sets the pattern property


getMinLength

public int getMinLength()

setMinLength

public void setMinLength(int minLength)

getMaxLength

public int getMaxLength()

setMaxLength

public void setMaxLength(int maxLength)

setSources

public void setSources(Generator[] sources)
Sets the source generators


init

public void init(GeneratorContext context)
ensures consistency of the generator's state

Specified by:
init in interface Generator<java.lang.String>
Overrides:
init in class AbstractGenerator<java.lang.String>

getGeneratedType

public java.lang.Class<java.lang.String> getGeneratedType()
Description copied from interface: Generator
Declares the type of the objects returned by the generate() method.


generateImpl

public java.lang.String generateImpl()
Implementation of ValidatingGenerator's generation callback method

Specified by:
generateImpl in class ValidatingGenerator<java.lang.String>

reset

public void reset()
Specified by:
reset in interface Resettable
Overrides:
reset in class AbstractGenerator<java.lang.String>
See Also:
Resettable.reset()

isParallelizable

public boolean isParallelizable()

isThreadSafe

public boolean isThreadSafe()

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<java.lang.String>
Overrides:
close in class AbstractGenerator<java.lang.String>
See Also:
Generator.close()

toString

public java.lang.String toString()
Returns a String representation of the generator

Overrides:
toString in class AbstractGenerator<java.lang.String>


Copyright © 2010. All Rights Reserved.