Package org.relaxng.datatype.helpers
Class ParameterlessDatatypeBuilder
- java.lang.Object
-
- org.relaxng.datatype.helpers.ParameterlessDatatypeBuilder
-
- All Implemented Interfaces:
DatatypeBuilder
public final class ParameterlessDatatypeBuilder extends java.lang.Object implements DatatypeBuilder
Dummy implementation ofDatatypeBuilder. This implementation can be used for Datatypes which have no parameters. Any attempt to add parameters will be rejected.Typical usage would be:
class MyDatatypeLibrary implements DatatypeLibrary { .... DatatypeBuilder createDatatypeBuilder( String typeName ) { return new ParameterleessDatatypeBuilder(createDatatype(typeName)); } .... } - Author:
- Kohsuke KAWAGUCHI
-
-
Constructor Summary
Constructors Constructor Description ParameterlessDatatypeBuilder(Datatype baseType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddParameter(java.lang.String name, java.lang.String strValue, ValidationContext context)Adds a new parameter.DatatypecreateDatatype()Derives a new Datatype from a Datatype by parameters that were already set through the addParameter method.
-
-
-
Constructor Detail
-
ParameterlessDatatypeBuilder
public ParameterlessDatatypeBuilder(Datatype baseType)
-
-
Method Detail
-
addParameter
public void addParameter(java.lang.String name, java.lang.String strValue, ValidationContext context) throws DatatypeExceptionDescription copied from interface:DatatypeBuilderAdds a new parameter.- Specified by:
addParameterin interfaceDatatypeBuilder- Parameters:
name- The name of the parameter to be added.strValue- 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 occurred.
-
createDatatype
public Datatype createDatatype() throws DatatypeException
Description copied from interface:DatatypeBuilderDerives a new Datatype from a Datatype by parameters that were already set through the addParameter method.- Specified by:
createDatatypein interfaceDatatypeBuilder- Throws:
DatatypeException- DatatypeException must be thrown if the derivation is somehow invalid. For example, a required parameter is missing, etc. The exception should contain a diagnosis message if possible.
-
-