com.sun.msv.generator
Class DataTypeGeneratorImpl
java.lang.Object
com.sun.msv.generator.DataTypeGeneratorImpl
- All Implemented Interfaces:
- DataTypeGenerator
public class DataTypeGeneratorImpl
- extends Object
- implements DataTypeGenerator
default implementation of DataTypeGenerator.
You may want to override this class to implement custom generator for
unimplemented datatype or datatype local to your schema.
- Author:
- Kohsuke KAWAGUCHI
Field Summary |
boolean |
asciiOnly
if this flag is set to true, then non-ASCII characters will not be used. |
protected Map |
generatedValues
map from DataType to Set that holds generated values for types. |
protected Set |
tokens
set that contains tokens that are found in example files. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
asciiOnly
public boolean asciiOnly
- if this flag is set to true, then non-ASCII characters will not be used.
generatedValues
protected Map generatedValues
- map from DataType to Set that holds generated values for types.
This map is used when we fail to generate an appropriate value for a type.
tokens
protected Set tokens
- set that contains tokens that are found in example files.
This set is used as the last resort to generate a value for a type.
DataTypeGeneratorImpl
public DataTypeGeneratorImpl()
DataTypeGeneratorImpl
public DataTypeGeneratorImpl(Random random)
generate
public String generate(Datatype dt,
ContextProviderImpl context)
- Specified by:
generate
in interface DataTypeGenerator
_generate
protected String _generate(Datatype dt,
ContextProviderImpl context)
- actual generation.
this method can return an invalid value.
fail
protected void fail(Datatype dt)
generateNMTOKEN
protected String generateNMTOKEN()
generateUnion
protected String generateUnion(UnionType ut,
ContextProviderImpl context)
generateList
protected String generateList(XSDatatypeImpl dti,
ContextProviderImpl context)
generateNCName
protected String generateNCName()
generateDecimal
protected String generateDecimal()
generateBoolean
protected String generateBoolean()
generateString
protected String generateString()
generateFloating
protected String generateFloating()
MSV