E - the type of elements held in this generator.public abstract class BaseGenerator<E> extends Object implements Generator<E>
| Constructor and Description |
|---|
BaseGenerator()
Create a new generator.
|
BaseGenerator(Generator<?> generator)
A generator can wrap another generator.
|
| Modifier and Type | Method and Description |
|---|---|
protected Generator<?> |
getWrappedGenerator()
Get the generator that is being wrapped.
|
boolean |
isStopped()
Check if the generator is stopped.
|
void |
stop()
Stop the generator.
|
<C extends Collection<? super E>> |
to(C collection)
Same as to(new CollectionTransformer(collection)).
|
<T> T |
to(UnaryFunction<Generator<? extends E>,? extends T> transformer)
Transforms this generator using the passed in
transformer.
|
Collection<E> |
toCollection()
Same as to(new CollectionTransformer()).
|
public BaseGenerator()
public BaseGenerator(Generator<?> generator)
stop() method to stop the wrapped generator as well.generator - Generator to wrapprotected Generator<?> getWrappedGenerator()
public void stop()
public boolean isStopped()
public final <T> T to(UnaryFunction<Generator<? extends E>,? extends T> transformer)
Collection of elements.
Transforms this generator using the passed in
UnaryFunction. An example function might turn the contents of the
generator into a Collection of elements.to in interface Generator<E>T - the returned value type of the input UnaryFunction.transformer - UnaryFunction to apply to thispublic final <C extends Collection<? super E>> C to(C collection)
public final Collection<E> toCollection()
toCollection in interface Generator<E>Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.