001: /*
002: Copyright (c) 2004-2005, Dennis M. Sosnoski
003: All rights reserved.
004:
005: Redistribution and use in source and binary forms, with or without modification,
006: are permitted provided that the following conditions are met:
007:
008: * Redistributions of source code must retain the above copyright notice, this
009: list of conditions and the following disclaimer.
010: * Redistributions in binary form must reproduce the above copyright notice,
011: this list of conditions and the following disclaimer in the documentation
012: and/or other materials provided with the distribution.
013: * Neither the name of JiBX nor the names of its contributors may be used
014: to endorse or promote products derived from this software without specific
015: prior written permission.
016:
017: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
018: ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
019: WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
020: DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
021: ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
022: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
023: LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
024: ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
025: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
026: SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
027: */
028:
029: package org.jibx.binding.model;
030:
031: /**
032: * Child component interface definition. This is the basic interface implemented
033: * by every binding definition element that actually participates in the nested
034: * structure of a binding (as opposed to elements such as <b>format</b>
035: * elements, which are simply convenience shortcuts). It defines the hooks used
036: * to handle structure validation of a binding definition model.
037: *
038: * @author Dennis M. Sosnoski
039: * @version 1.0
040: */
041:
042: public interface IComponent {
043: /**
044: * Check if component is an optional item.
045: *
046: * @return <code>true</code> if optional, <code>false</code> if required
047: */
048: public boolean isOptional();
049:
050: /**
051: * Check if component defines one or more attribute values of the
052: * containing element. This method is only valid after the call to {@link
053: * setLinkages}.
054: *
055: * @return <code>true</code> if one or more attribute values defined for
056: * containing element, <code>false</code> if not
057: */
058: public boolean hasAttribute();
059:
060: /**
061: * Check if component defines one or more elements or text values as
062: * children of the containing element. This method is only valid after the
063: * call to {@link setLinkages}.
064: *
065: * @return <code>true</code> if one or more content values defined
066: * for containing element, <code>false</code> if not
067: */
068: public boolean hasContent();
069:
070: /**
071: * Check if component has a name.
072: *
073: * @return <code>true</code> if component has a name, <code>false</code> if
074: * not
075: */
076: public boolean hasName();
077:
078: /**
079: * Get name.
080: *
081: * @return name text
082: */
083: public String getName();
084:
085: /**
086: * Get specified namespace URI.
087: *
088: * @return namespace URI (<code>null</code> if not set)
089: */
090: public String getUri();
091:
092: /**
093: * Get value type information. This call is only meaningful after
094: * prevalidation.
095: *
096: * @return type information
097: */
098: public IClass getType();
099:
100: /**
101: * Check if this structure implicitly uses the containing object. This call
102: * is only meaningful after prevalidation.
103: *
104: * @return <code>true</code> if using the containing object,
105: * <code>false</code> if own object
106: */
107: public boolean isImplicit();
108: }
|