com.thaiopensource.datatype.xsd
Class DatatypeBuilderImpl

java.lang.Object
  extended by com.thaiopensource.datatype.xsd.DatatypeBuilderImpl
All Implemented Interfaces:
DatatypeBuilder

 class DatatypeBuilderImpl
extends Object
implements DatatypeBuilder


Field Summary
private  DatatypeBase base
           
private  DatatypeLibraryImpl library
           
(package private) static Localizer localizer
           
 
Constructor Summary
DatatypeBuilderImpl(DatatypeLibraryImpl library, DatatypeBase base)
           
 
Method Summary
private  void addLengthParam(String value)
           
private  void addMaxExclusiveParam(String value, ValidationContext context)
           
private  void addMaxInclusiveParam(String value, ValidationContext context)
           
private  void addMaxLengthParam(String value)
           
private  void addMinExclusiveParam(String value, ValidationContext context)
           
private  void addMinInclusiveParam(String value, ValidationContext context)
           
private  void addMinLengthParam(String value)
           
 void addParameter(String name, String value, ValidationContext context)
          Adds a new parameter.
private  void addPatternParam(String value)
           
private  void addPrecisionParam(String str)
           
private  void addScaleParam(String str)
           
private  int convertNonNegativeInteger(String str)
           
 Datatype createDatatype()
          Derives a new Datatype from a Datatype by parameters that were already set through the addParameter method.
private static void error(String key)
           
private static void error(String key, String arg)
           
private static void error(String key, String arg, int pos)
           
private  int getLength(String str)
           
private  Object getLimit(String str, ValidationContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localizer

static final Localizer localizer

base

private DatatypeBase base

library

private final DatatypeLibraryImpl library
Constructor Detail

DatatypeBuilderImpl

DatatypeBuilderImpl(DatatypeLibraryImpl library,
                    DatatypeBase base)
              throws DatatypeException
Throws:
DatatypeException
Method Detail

addParameter

public void addParameter(String name,
                         String value,
                         ValidationContext context)
                  throws DatatypeException
Description copied from interface: DatatypeBuilder
Adds a new parameter.

Specified by:
addParameter in interface DatatypeBuilder
Parameters:
name - The name of the parameter to be added.
value - The raw value of the parameter. Caller may not normalize this value because any white space is potentially significant.
context - The context information which can be used by the callee to acquire additional information. This context object is valid only during this method call. The callee may not keep a reference to this object.
Throws:
DatatypeException - When the given parameter is inappropriate for some reason. The callee is responsible to recover from this error. That is, the object should behave as if no such error was occured.

addPatternParam

private void addPatternParam(String value)
                      throws DatatypeException
Throws:
DatatypeException

addMinInclusiveParam

private void addMinInclusiveParam(String value,
                                  ValidationContext context)
                           throws DatatypeException
Throws:
DatatypeException

addMaxInclusiveParam

private void addMaxInclusiveParam(String value,
                                  ValidationContext context)
                           throws DatatypeException
Throws:
DatatypeException

addMinExclusiveParam

private void addMinExclusiveParam(String value,
                                  ValidationContext context)
                           throws DatatypeException
Throws:
DatatypeException

addMaxExclusiveParam

private void addMaxExclusiveParam(String value,
                                  ValidationContext context)
                           throws DatatypeException
Throws:
DatatypeException

getLimit

private Object getLimit(String str,
                        ValidationContext context)
                 throws DatatypeException
Throws:
DatatypeException

addLengthParam

private void addLengthParam(String value)
                     throws DatatypeException
Throws:
DatatypeException

addMinLengthParam

private void addMinLengthParam(String value)
                        throws DatatypeException
Throws:
DatatypeException

addMaxLengthParam

private void addMaxLengthParam(String value)
                        throws DatatypeException
Throws:
DatatypeException

getLength

private int getLength(String str)
               throws DatatypeException
Throws:
DatatypeException

addScaleParam

private void addScaleParam(String str)
                    throws DatatypeException
Throws:
DatatypeException

addPrecisionParam

private void addPrecisionParam(String str)
                        throws DatatypeException
Throws:
DatatypeException

createDatatype

public Datatype createDatatype()
Description copied from interface: DatatypeBuilder
Derives a new Datatype from a Datatype by parameters that were already set through the addParameter method.

Specified by:
createDatatype in interface DatatypeBuilder

error

private static void error(String key)
                   throws DatatypeException
Throws:
DatatypeException

error

private static void error(String key,
                          String arg)
                   throws DatatypeException
Throws:
DatatypeException

error

private static void error(String key,
                          String arg,
                          int pos)
                   throws DatatypeException
Throws:
DatatypeException

convertNonNegativeInteger

private int convertNonNegativeInteger(String str)