1 /* 2 Copyright (c) 2004-2005, Dennis M. Sosnoski 3 All rights reserved. 4 5 Redistribution and use in source and binary forms, with or without modification, 6 are permitted provided that the following conditions are met: 7 8 * Redistributions of source code must retain the above copyright notice, this 9 list of conditions and the following disclaimer. 10 * Redistributions in binary form must reproduce the above copyright notice, 11 this list of conditions and the following disclaimer in the documentation 12 and/or other materials provided with the distribution. 13 * Neither the name of JiBX nor the names of its contributors may be used 14 to endorse or promote products derived from this software without specific 15 prior written permission. 16 17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 package org.jibx.binding.model; 30 31 /** 32 * Child component interface definition. This is the basic interface implemented 33 * by every binding definition element that actually participates in the nested 34 * structure of a binding (as opposed to elements such as <b>format</b> 35 * elements, which are simply convenience shortcuts). It defines the hooks used 36 * to handle structure validation of a binding definition model. 37 * 38 * @author Dennis M. Sosnoski 39 * @version 1.0 40 */ 41 42 public interface IComponent 43 { 44 /** 45 * Check if component is an optional item. 46 * 47 * @return <code>true</code> if optional, <code>false</code> if required 48 */ 49 public boolean isOptional(); 50 51 /** 52 * Check if component defines one or more attribute values of the 53 * containing element. This method is only valid after the call to {@link 54 * setLinkages}. 55 * 56 * @return <code>true</code> if one or more attribute values defined for 57 * containing element, <code>false</code> if not 58 */ 59 public boolean hasAttribute(); 60 61 /** 62 * Check if component defines one or more elements or text values as 63 * children of the containing element. This method is only valid after the 64 * call to {@link setLinkages}. 65 * 66 * @return <code>true</code> if one or more content values defined 67 * for containing element, <code>false</code> if not 68 */ 69 public boolean hasContent(); 70 71 /** 72 * Check if component has a name. 73 * 74 * @return <code>true</code> if component has a name, <code>false</code> if 75 * not 76 */ 77 public boolean hasName(); 78 79 /** 80 * Check if component has an associated type. This method is not meaningful 81 * until after validation. 82 * 83 * @return <code>true</code> if component has a type, <code>false</code> if 84 * not 85 */ 86 public boolean hasType(); 87 88 /** 89 * Get value type information. This call is only meaningful after 90 * prevalidation. 91 * 92 * @return type information 93 */ 94 public IClass getType(); 95 96 /** 97 * Check if this structure implicitly uses the containing object. This call 98 * is only meaningful after prevalidation. 99 * 100 * @return <code>true</code> if using the containing object, 101 * <code>false</code> if own object 102 */ 103 public boolean isImplicit(); 104 }