org.databene.benerator.primitive
Class RegexStringGenerator

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.wrapper.NonNullGeneratorProxy<java.lang.String>
                  extended by org.databene.benerator.primitive.RegexStringGenerator
All Implemented Interfaces:
java.io.Closeable, Generator<java.lang.String>, NonNullGenerator<java.lang.String>, org.databene.commons.Resettable, org.databene.commons.ThreadAware

public class RegexStringGenerator
extends NonNullGeneratorProxy<java.lang.String>

Generates Strings that comply to a regular expression.

Created: 18.07.2006 19:32:52

Since:
0.1
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
RegexStringGenerator()
          Initializes the generator to an empty regular expression, a maxQuantity of 30 and the fallback locale
RegexStringGenerator(int maxLength)
          Initializes the generator to an empty regular expression and the fallback locale
RegexStringGenerator(java.lang.String pattern)
          Initializes the generator to a maxQuantity of 30 and the fallback locale
RegexStringGenerator(java.lang.String pattern, int maxLength)
          Initializes the generator to the fallback locale
RegexStringGenerator(java.lang.String pattern, java.lang.Integer maxLength, boolean unique)
          Initializes the generator with the String representation of a regular expression
 
Method Summary
protected  GeneratorFactory getGeneratorFactory(GeneratorContext context)
           
 java.util.Locale getLocale()
           
 int getMaxLength()
           
 int getMinLength()
           
 java.lang.String getPattern()
          Sets the String representation of the regular expression
 void init(GeneratorContext context)
          ensures consistency of the generators state
 boolean isOrdered()
           
 boolean isUnique()
           
 void setLocale(java.util.Locale locale)
           
 void setMinLength(int minLength)
           
 void setOrdered(boolean ordered)
           
 void setPattern(java.lang.String pattern)
          Returns the String representation of the regular expression
 void setUnique(boolean unique)
           
 java.lang.String toString()
           
 
Methods inherited from class org.databene.benerator.wrapper.NonNullGeneratorProxy
generate, generate, generateFromNotNullSource, getSource, setSource
 
Methods inherited from class org.databene.benerator.wrapper.GeneratorProxy
getGeneratedType
 
Methods inherited from class org.databene.benerator.wrapper.GeneratorWrapper
close, equals, generateFromSource, getSourceWrapper, hashCode, isParallelizable, isThreadSafe, reset
 
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
 
Methods inherited from interface org.databene.benerator.Generator
close, getGeneratedType, wasInitialized
 
Methods inherited from interface org.databene.commons.ThreadAware
isParallelizable, isThreadSafe
 
Methods inherited from interface org.databene.commons.Resettable
reset
 

Constructor Detail

RegexStringGenerator

public RegexStringGenerator()
Initializes the generator to an empty regular expression, a maxQuantity of 30 and the fallback locale


RegexStringGenerator

public RegexStringGenerator(int maxLength)
Initializes the generator to an empty regular expression and the fallback locale


RegexStringGenerator

public RegexStringGenerator(java.lang.String pattern)
Initializes the generator to a maxQuantity of 30 and the fallback locale


RegexStringGenerator

public RegexStringGenerator(java.lang.String pattern,
                            int maxLength)
Initializes the generator to the fallback locale


RegexStringGenerator

public RegexStringGenerator(java.lang.String pattern,
                            java.lang.Integer maxLength,
                            boolean unique)
Initializes the generator with the String representation of a regular expression

Method Detail

getPattern

public java.lang.String getPattern()
Sets the String representation of the regular expression


setPattern

public void setPattern(java.lang.String pattern)
Returns the String representation of the regular expression


isUnique

public boolean isUnique()

setUnique

public void setUnique(boolean unique)

isOrdered

public boolean isOrdered()

setOrdered

public void setOrdered(boolean ordered)

getLocale

public java.util.Locale getLocale()

setLocale

public void setLocale(java.util.Locale locale)

getMinLength

public int getMinLength()

setMinLength

public void setMinLength(int minLength)

getMaxLength

public int getMaxLength()

init

public void init(GeneratorContext context)
ensures consistency of the generators state

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

getGeneratorFactory

protected GeneratorFactory getGeneratorFactory(GeneratorContext context)

toString

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


Copyright © 2013. All Rights Reserved.