1 package org.relaxng.datatype; 2 3 /** 4 * Creates a user-defined type by adding parameters to 5 * the pre-defined type. 6 * 7 * @author <a HREF="mailto:jjc@jclark.com">James Clark</a> 8 * @author <a HREF="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a> 9 */ 10 public interface DatatypeBuilder { 11 12 /** 13 * Adds a new parameter. 14 * 15 * @param name 16 * The name of the parameter to be added. 17 * @param strValue 18 * The raw value of the parameter. Caller may not normalize 19 * this value because any white space is potentially significant. 20 * @param context 21 * The context information which can be used by the callee to 22 * acquire additional information. This context object is 23 * valid only during this method call. The callee may not 24 * keep a reference to this object. 25 * @exception DatatypeException 26 * When the given parameter is inappropriate for some reason. 27 * The callee is responsible to recover from this error. 28 * That is, the object should behave as if no such error 29 * was occured. 30 */ 31 void addParameter( String name, String strValue, ValidationContext context ) 32 throws DatatypeException; 33 34 /** 35 * Derives a new Datatype from a Datatype by parameters that 36 * were already set through the addParameter method. 37 * 38 * @exception DatatypeException 39 * DatatypeException must be thrown if the derivation is 40 * somehow invalid. For example, a required parameter is missing, 41 * etc. The exception should contain a diagnosis message 42 * if possible. 43 */ 44 Datatype createDatatype() throws DatatypeException; 45 } 46