1 /** |
|
2 * Copyright (c) 2001, Thai Open Source Software Center Ltd |
|
3 * All rights reserved. |
|
4 * |
|
5 * Redistribution and use in source and binary forms, with or without |
|
6 * modification, are permitted provided that the following conditions are |
|
7 * met: |
|
8 * |
|
9 * Redistributions of source code must retain the above copyright |
|
10 * notice, this list of conditions and the following disclaimer. |
|
11 * |
|
12 * Redistributions in binary form must reproduce the above copyright |
|
13 * notice, this list of conditions and the following disclaimer in |
|
14 * the documentation and/or other materials provided with the |
|
15 * distribution. |
|
16 * |
|
17 * Neither the name of the Thai Open Source Software Center Ltd nor |
|
18 * the names of its contributors may be used to endorse or promote |
|
19 * products derived from this software without specific prior written |
|
20 * permission. |
|
21 * |
|
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR |
|
26 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
|
27 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
|
28 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
|
29 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
|
30 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
|
31 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
33 */ |
|
34 package org.relaxng.datatype; |
|
35 |
|
36 /** |
|
37 * Creates a user-defined type by adding parameters to |
|
38 * the pre-defined type. |
|
39 * |
|
40 * @author <a href="mailto:jjc@jclark.com">James Clark</a> |
|
41 * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a> |
|
42 */ |
|
43 public interface DatatypeBuilder { |
|
44 |
|
45 /** |
|
46 * Adds a new parameter. |
|
47 * |
|
48 * @param name |
|
49 * The name of the parameter to be added. |
|
50 * @param strValue |
|
51 * The raw value of the parameter. Caller may not normalize |
|
52 * this value because any white space is potentially significant. |
|
53 * @param context |
|
54 * The context information which can be used by the callee to |
|
55 * acquire additional information. This context object is |
|
56 * valid only during this method call. The callee may not |
|
57 * keep a reference to this object. |
|
58 * @exception DatatypeException |
|
59 * When the given parameter is inappropriate for some reason. |
|
60 * The callee is responsible to recover from this error. |
|
61 * That is, the object should behave as if no such error |
|
62 * was occured. |
|
63 */ |
|
64 void addParameter( String name, String strValue, ValidationContext context ) |
|
65 throws DatatypeException; |
|
66 |
|
67 /** |
|
68 * Derives a new Datatype from a Datatype by parameters that |
|
69 * were already set through the addParameter method. |
|
70 * |
|
71 * @exception DatatypeException |
|
72 * DatatypeException must be thrown if the derivation is |
|
73 * somehow invalid. For example, a required parameter is missing, |
|
74 * etc. The exception should contain a diagnosis message |
|
75 * if possible. |
|
76 */ |
|
77 Datatype createDatatype() throws DatatypeException; |
|
78 } |
|