01: /*
02: * The contents of this file are subject to the terms
03: * of the Common Development and Distribution License
04: * (the "License"). You may not use this file except
05: * in compliance with the License.
06: *
07: * You can obtain a copy of the license at
08: * https://jwsdp.dev.java.net/CDDLv1.0.html
09: * See the License for the specific language governing
10: * permissions and limitations under the License.
11: *
12: * When distributing Covered Code, include this CDDL
13: * HEADER in each file and include the License file at
14: * https://jwsdp.dev.java.net/CDDLv1.0.html If applicable,
15: * add the following below this CDDL HEADER, with the
16: * fields enclosed by brackets "[]" replaced with your
17: * own identifying information: Portions Copyright [yyyy]
18: * [name of copyright owner]
19: */
20: package com.sun.xml.xsom;
21:
22: import java.util.Iterator;
23: import java.util.Collection;
24:
25: import com.sun.xml.xsom.visitor.XSWildcardFunction;
26: import com.sun.xml.xsom.visitor.XSWildcardVisitor;
27:
28: /**
29: * Wildcard schema component (used for both attribute wildcard
30: * and element wildcard.)
31: *
32: * XSWildcard interface can always be downcasted to either
33: * Any, Other, or Union.
34: */
35: public interface XSWildcard extends XSComponent, XSTerm {
36: static final int LAX = 1;
37: static final int STRTICT = 2;
38: static final int SKIP = 3;
39:
40: /**
41: * Gets the processing mode.
42: *
43: * @return
44: * Either LAX, STRICT, or SKIP.
45: */
46: int getMode();
47:
48: /**
49: * Returns true if the specified namespace URI is valid
50: * wrt this wildcard.
51: *
52: * @param namespaceURI
53: * Use the empty string to test the default no-namespace.
54: */
55: boolean acceptsNamespace(String namespaceURI);
56:
57: /** Visitor support. */
58: void visit(XSWildcardVisitor visitor);
59:
60: <T> T apply(XSWildcardFunction<T> function);
61:
62: /**
63: * <code>##any</code> wildcard.
64: */
65: interface Any extends XSWildcard {
66: }
67:
68: /**
69: * <code>##other</code> wildcard.
70: */
71: interface Other extends XSWildcard {
72: /**
73: * Gets the namespace URI excluded from this wildcard.
74: */
75: String getOtherNamespace();
76: }
77:
78: /**
79: * Wildcard of a set of namespace URIs.
80: */
81: interface Union extends XSWildcard {
82: /**
83: * Short for <code>getNamespaces().iterator()</code>
84: */
85: Iterator<String> iterateNamespaces();
86:
87: /**
88: * Read-only list of namespace URIs.
89: */
90: Collection<String> getNamespaces();
91: }
92: }
|