001: /*
002: * The contents of this file are subject to the terms
003: * of the Common Development and Distribution License
004: * (the "License"). You may not use this file except
005: * in compliance with the License.
006: *
007: * You can obtain a copy of the license at
008: * https://jwsdp.dev.java.net/CDDLv1.0.html
009: * See the License for the specific language governing
010: * permissions and limitations under the License.
011: *
012: * When distributing Covered Code, include this CDDL
013: * HEADER in each file and include the License file at
014: * https://jwsdp.dev.java.net/CDDLv1.0.html If applicable,
015: * add the following below this CDDL HEADER, with the
016: * fields enclosed by brackets "[]" replaced with your
017: * own identifying information: Portions Copyright [yyyy]
018: * [name of copyright owner]
019: */
020: package com.sun.xml.xsom.util;
021:
022: import com.sun.xml.xsom.XSAnnotation;
023: import com.sun.xml.xsom.XSAttGroupDecl;
024: import com.sun.xml.xsom.XSAttributeDecl;
025: import com.sun.xml.xsom.XSAttributeUse;
026: import com.sun.xml.xsom.XSComplexType;
027: import com.sun.xml.xsom.XSComponent;
028: import com.sun.xml.xsom.XSContentType;
029: import com.sun.xml.xsom.XSElementDecl;
030: import com.sun.xml.xsom.XSFacet;
031: import com.sun.xml.xsom.XSModelGroup;
032: import com.sun.xml.xsom.XSModelGroupDecl;
033: import com.sun.xml.xsom.XSNotation;
034: import com.sun.xml.xsom.XSParticle;
035: import com.sun.xml.xsom.XSSchema;
036: import com.sun.xml.xsom.XSSimpleType;
037: import com.sun.xml.xsom.XSWildcard;
038: import com.sun.xml.xsom.XSIdentityConstraint;
039: import com.sun.xml.xsom.XSXPath;
040: import com.sun.xml.xsom.visitor.XSFunction;
041:
042: /**
043: * Utility implementation of {@link XSFunction} that returns
044: * {@link Boolean} to find something from schema objects.
045: *
046: * <p>
047: * This implementation returns <code>Boolean.FALSE</code> from
048: * all of the methods. The derived class is expected to override
049: * some of the methods to actually look for something.
050: *
051: * @author
052: * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
053: */
054: public class XSFinder implements XSFunction<Boolean> {
055:
056: /**
057: * Invokes this object as a visitor with the specified component.
058: */
059: public final boolean find(XSComponent c) {
060: return c.apply(this );
061: }
062:
063: /**
064: * @see com.sun.xml.xsom.visitor.XSFunction#annotation(com.sun.xml.xsom.XSAnnotation)
065: */
066: public Boolean annotation(XSAnnotation ann) {
067: return Boolean.FALSE;
068: }
069:
070: /**
071: * @see com.sun.xml.xsom.visitor.XSFunction#attGroupDecl(com.sun.xml.xsom.XSAttGroupDecl)
072: */
073: public Boolean attGroupDecl(XSAttGroupDecl decl) {
074: return Boolean.FALSE;
075: }
076:
077: /**
078: * @see com.sun.xml.xsom.visitor.XSFunction#attributeDecl(com.sun.xml.xsom.XSAttributeDecl)
079: */
080: public Boolean attributeDecl(XSAttributeDecl decl) {
081: return Boolean.FALSE;
082: }
083:
084: /**
085: * @see com.sun.xml.xsom.visitor.XSFunction#attributeUse(com.sun.xml.xsom.XSAttributeUse)
086: */
087: public Boolean attributeUse(XSAttributeUse use) {
088: return Boolean.FALSE;
089: }
090:
091: /**
092: * @see com.sun.xml.xsom.visitor.XSFunction#complexType(com.sun.xml.xsom.XSComplexType)
093: */
094: public Boolean complexType(XSComplexType type) {
095: return Boolean.FALSE;
096: }
097:
098: /**
099: * @see com.sun.xml.xsom.visitor.XSFunction#schema(com.sun.xml.xsom.XSSchema)
100: */
101: public Boolean schema(XSSchema schema) {
102: return Boolean.FALSE;
103: }
104:
105: /**
106: * @see com.sun.xml.xsom.visitor.XSFunction#facet(com.sun.xml.xsom.XSFacet)
107: */
108: public Boolean facet(XSFacet facet) {
109: return Boolean.FALSE;
110: }
111:
112: /**
113: * @see com.sun.xml.xsom.visitor.XSFunction#notation(com.sun.xml.xsom.XSNotation)
114: */
115: public Boolean notation(XSNotation notation) {
116: return Boolean.FALSE;
117: }
118:
119: /**
120: * @see com.sun.xml.xsom.visitor.XSContentTypeFunction#simpleType(com.sun.xml.xsom.XSSimpleType)
121: */
122: public Boolean simpleType(XSSimpleType simpleType) {
123: return Boolean.FALSE;
124: }
125:
126: /**
127: * @see com.sun.xml.xsom.visitor.XSContentTypeFunction#particle(com.sun.xml.xsom.XSParticle)
128: */
129: public Boolean particle(XSParticle particle) {
130: return Boolean.FALSE;
131: }
132:
133: /**
134: * @see com.sun.xml.xsom.visitor.XSContentTypeFunction#empty(com.sun.xml.xsom.XSContentType)
135: */
136: public Boolean empty(XSContentType empty) {
137: return Boolean.FALSE;
138: }
139:
140: /**
141: * @see com.sun.xml.xsom.visitor.XSTermFunction#wildcard(com.sun.xml.xsom.XSWildcard)
142: */
143: public Boolean wildcard(XSWildcard wc) {
144: return Boolean.FALSE;
145: }
146:
147: /**
148: * @see com.sun.xml.xsom.visitor.XSTermFunction#modelGroupDecl(com.sun.xml.xsom.XSModelGroupDecl)
149: */
150: public Boolean modelGroupDecl(XSModelGroupDecl decl) {
151: return Boolean.FALSE;
152: }
153:
154: /**
155: * @see com.sun.xml.xsom.visitor.XSTermFunction#modelGroup(com.sun.xml.xsom.XSModelGroup)
156: */
157: public Boolean modelGroup(XSModelGroup group) {
158: return Boolean.FALSE;
159: }
160:
161: /**
162: * @see com.sun.xml.xsom.visitor.XSTermFunction#elementDecl(com.sun.xml.xsom.XSElementDecl)
163: */
164: public Boolean elementDecl(XSElementDecl decl) {
165: return Boolean.FALSE;
166: }
167:
168: public Boolean identityConstraint(XSIdentityConstraint decl) {
169: return Boolean.FALSE;
170: }
171:
172: public Boolean xpath(XSXPath xpath) {
173: return Boolean.FALSE;
174: }
175: }
|