001 package org.relaxng.datatype;
002
003 /**
004 * Creates a user-defined type by adding parameters to
005 * the pre-defined type.
006 *
007 * @author <a href="mailto:jjc@jclark.com">James Clark</a>
008 * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
009 */
010 public interface DatatypeBuilder {
011
012 /**
013 * Adds a new parameter.
014 *
015 * @param name
016 * The name of the parameter to be added.
017 * @param strValue
018 * The raw value of the parameter. Caller may not normalize
019 * this value because any white space is potentially significant.
020 * @param context
021 * The context information which can be used by the callee to
022 * acquire additional information. This context object is
023 * valid only during this method call. The callee may not
024 * keep a reference to this object.
025 * @exception DatatypeException
026 * When the given parameter is inappropriate for some reason.
027 * The callee is responsible to recover from this error.
028 * That is, the object should behave as if no such error
029 * was occured.
030 */
031 void addParameter( String name, String strValue, ValidationContext context )
032 throws DatatypeException;
033
034 /**
035 * Derives a new Datatype from a Datatype by parameters that
036 * were already set through the addParameter method.
037 *
038 * @exception DatatypeException
039 * DatatypeException must be thrown if the derivation is
040 * somehow invalid. For example, a required parameter is missing,
041 * etc. The exception should contain a diagnosis message
042 * if possible.
043 */
044 Datatype createDatatype() throws DatatypeException;
045 }