Thu, 31 Aug 2017 15:18:52 +0800
merge
1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
26 package com.sun.xml.internal.xsom.util;
28 import com.sun.xml.internal.xsom.XSAnnotation;
29 import com.sun.xml.internal.xsom.XSAttGroupDecl;
30 import com.sun.xml.internal.xsom.XSAttributeDecl;
31 import com.sun.xml.internal.xsom.XSAttributeUse;
32 import com.sun.xml.internal.xsom.XSComplexType;
33 import com.sun.xml.internal.xsom.XSComponent;
34 import com.sun.xml.internal.xsom.XSContentType;
35 import com.sun.xml.internal.xsom.XSElementDecl;
36 import com.sun.xml.internal.xsom.XSFacet;
37 import com.sun.xml.internal.xsom.XSModelGroup;
38 import com.sun.xml.internal.xsom.XSModelGroupDecl;
39 import com.sun.xml.internal.xsom.XSNotation;
40 import com.sun.xml.internal.xsom.XSParticle;
41 import com.sun.xml.internal.xsom.XSSchema;
42 import com.sun.xml.internal.xsom.XSSimpleType;
43 import com.sun.xml.internal.xsom.XSWildcard;
44 import com.sun.xml.internal.xsom.XSIdentityConstraint;
45 import com.sun.xml.internal.xsom.XSXPath;
46 import com.sun.xml.internal.xsom.visitor.XSFunction;
48 /**
49 * Utility implementation of {@link XSFunction} that returns
50 * {@link Boolean} to find something from schema objects.
51 *
52 * <p>
53 * This implementation returns <code>Boolean.FALSE</code> from
54 * all of the methods. The derived class is expected to override
55 * some of the methods to actually look for something.
56 *
57 * @author
58 * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
59 */
60 public class XSFinder implements XSFunction<Boolean> {
62 /**
63 * Invokes this object as a visitor with the specified component.
64 */
65 public final boolean find( XSComponent c ) {
66 return c.apply(this);
67 }
69 /**
70 * @see com.sun.xml.internal.xsom.visitor.XSFunction#annotation(com.sun.xml.internal.xsom.XSAnnotation)
71 */
72 public Boolean annotation(XSAnnotation ann) {
73 return Boolean.FALSE;
74 }
76 /**
77 * @see com.sun.xml.internal.xsom.visitor.XSFunction#attGroupDecl(com.sun.xml.internal.xsom.XSAttGroupDecl)
78 */
79 public Boolean attGroupDecl(XSAttGroupDecl decl) {
80 return Boolean.FALSE;
81 }
83 /**
84 * @see com.sun.xml.internal.xsom.visitor.XSFunction#attributeDecl(com.sun.xml.internal.xsom.XSAttributeDecl)
85 */
86 public Boolean attributeDecl(XSAttributeDecl decl) {
87 return Boolean.FALSE;
88 }
90 /**
91 * @see com.sun.xml.internal.xsom.visitor.XSFunction#attributeUse(com.sun.xml.internal.xsom.XSAttributeUse)
92 */
93 public Boolean attributeUse(XSAttributeUse use) {
94 return Boolean.FALSE;
95 }
97 /**
98 * @see com.sun.xml.internal.xsom.visitor.XSFunction#complexType(com.sun.xml.internal.xsom.XSComplexType)
99 */
100 public Boolean complexType(XSComplexType type) {
101 return Boolean.FALSE;
102 }
104 /**
105 * @see com.sun.xml.internal.xsom.visitor.XSFunction#schema(com.sun.xml.internal.xsom.XSSchema)
106 */
107 public Boolean schema(XSSchema schema) {
108 return Boolean.FALSE;
109 }
111 /**
112 * @see com.sun.xml.internal.xsom.visitor.XSFunction#facet(com.sun.xml.internal.xsom.XSFacet)
113 */
114 public Boolean facet(XSFacet facet) {
115 return Boolean.FALSE;
116 }
118 /**
119 * @see com.sun.xml.internal.xsom.visitor.XSFunction#notation(com.sun.xml.internal.xsom.XSNotation)
120 */
121 public Boolean notation(XSNotation notation) {
122 return Boolean.FALSE;
123 }
125 /**
126 * @see com.sun.xml.internal.xsom.visitor.XSContentTypeFunction#simpleType(com.sun.xml.internal.xsom.XSSimpleType)
127 */
128 public Boolean simpleType(XSSimpleType simpleType) {
129 return Boolean.FALSE;
130 }
132 /**
133 * @see com.sun.xml.internal.xsom.visitor.XSContentTypeFunction#particle(com.sun.xml.internal.xsom.XSParticle)
134 */
135 public Boolean particle(XSParticle particle) {
136 return Boolean.FALSE;
137 }
139 /**
140 * @see com.sun.xml.internal.xsom.visitor.XSContentTypeFunction#empty(com.sun.xml.internal.xsom.XSContentType)
141 */
142 public Boolean empty(XSContentType empty) {
143 return Boolean.FALSE;
144 }
146 /**
147 * @see com.sun.xml.internal.xsom.visitor.XSTermFunction#wildcard(com.sun.xml.internal.xsom.XSWildcard)
148 */
149 public Boolean wildcard(XSWildcard wc) {
150 return Boolean.FALSE;
151 }
153 /**
154 * @see com.sun.xml.internal.xsom.visitor.XSTermFunction#modelGroupDecl(com.sun.xml.internal.xsom.XSModelGroupDecl)
155 */
156 public Boolean modelGroupDecl(XSModelGroupDecl decl) {
157 return Boolean.FALSE;
158 }
160 /**
161 * @see com.sun.xml.internal.xsom.visitor.XSTermFunction#modelGroup(com.sun.xml.internal.xsom.XSModelGroup)
162 */
163 public Boolean modelGroup(XSModelGroup group) {
164 return Boolean.FALSE;
165 }
167 /**
168 * @see com.sun.xml.internal.xsom.visitor.XSTermFunction#elementDecl(com.sun.xml.internal.xsom.XSElementDecl)
169 */
170 public Boolean elementDecl(XSElementDecl decl) {
171 return Boolean.FALSE;
172 }
174 public Boolean identityConstraint(XSIdentityConstraint decl) {
175 return Boolean.FALSE;
176 }
178 public Boolean xpath(XSXPath xpath) {
179 return Boolean.FALSE;
180 }
181 }