01: package org.databene.domain.person;
02:
03: import org.databene.benerator.LightweightGenerator;
04: import org.databene.benerator.Generator;
05: import org.databene.benerator.IllegalGeneratorStateException;
06: import org.databene.benerator.factory.GeneratorFactory;
07:
08: /**
09: * (c) Copyright 2006 by Volker Bergmann
10: * Created: 09.06.2006 21:45:23
11: */
12: public class GenderGenerator extends LightweightGenerator<Gender> {
13:
14: private Generator<Gender> gen;
15:
16: public GenderGenerator() {
17: this .gen = GeneratorFactory.getSampleGenerator(Gender.MALE,
18: Gender.FEMALE);
19: }
20:
21: public Class<Gender> getGeneratedType() {
22: return Gender.class;
23: }
24:
25: public Gender generate() throws IllegalGeneratorStateException {
26: return gen.generate();
27: }
28:
29: public String toString() {
30: return getClass().getSimpleName();
31: }
32: }
|