KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jibx > binding > def > PassThroughComponent


1 /*
2 Copyright (c) 2003, 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.def;
30
31 import org.jibx.binding.classes.ContextMethodBuilder;
32 import org.jibx.runtime.JiBXException;
33
34 /**
35  * Default component decorator. This just passes through all method calls to
36  * the wrapped component.
37  *
38  * @author Dennis M. Sosnoski
39  * @version 1.0
40  */

41
42 public class PassThroughComponent implements IComponent
43 {
44     /** Property value binding component. */
45     protected IComponent m_component;
46
47     /**
48      * No argument constructor. This requires the component to be set later,
49      * using the {@link #setWrappedComponent} method.
50      */

51
52     protected PassThroughComponent() {}
53
54     /**
55      * Constructor.
56      *
57      * @param comp wrapped component
58      */

59
60     protected PassThroughComponent(IComponent comp) {
61         m_component = comp;
62     }
63
64     /**
65      * Set the wrapped component.
66      *
67      * @param comp wrapped component
68      */

69
70     protected void setWrappedComponent(IComponent comp) {
71         m_component = comp;
72     }
73     
74     //
75
// IComponent interface method definitions
76

77     public boolean isOptional() {
78         return m_component.isOptional();
79     }
80
81     public boolean hasAttribute() {
82         return m_component.hasAttribute();
83     }
84
85     public void genAttrPresentTest(ContextMethodBuilder mb)
86         throws JiBXException {
87         m_component.genAttrPresentTest(mb);
88     }
89
90     public void genAttributeUnmarshal(ContextMethodBuilder mb)
91         throws JiBXException {
92         m_component.genAttributeUnmarshal(mb);
93     }
94
95     public void genAttributeMarshal(ContextMethodBuilder mb)
96         throws JiBXException {
97         m_component.genAttributeMarshal(mb);
98     }
99
100     public boolean hasContent() {
101         return m_component.hasContent();
102     }
103
104     public void genContentPresentTest(ContextMethodBuilder mb)
105         throws JiBXException {
106         m_component.genContentPresentTest(mb);
107     }
108
109     public void genContentUnmarshal(ContextMethodBuilder mb)
110         throws JiBXException {
111         m_component.genContentUnmarshal(mb);
112     }
113
114     public void genContentMarshal(ContextMethodBuilder mb)
115         throws JiBXException {
116         m_component.genContentMarshal(mb);
117     }
118     
119     public void genNewInstance(ContextMethodBuilder mb) throws JiBXException {
120         m_component.genNewInstance(mb);
121     }
122
123     public String JavaDoc getType() {
124         return m_component.getType();
125     }
126
127     public boolean hasId() {
128         return m_component.hasId();
129     }
130
131     public void genLoadId(ContextMethodBuilder mb) throws JiBXException {
132         m_component.genLoadId(mb);
133     }
134
135     public boolean checkContentSequence(boolean text) throws JiBXException {
136         return m_component.checkContentSequence(text);
137     }
138
139     public void setLinkages() throws JiBXException {
140         m_component.setLinkages();
141     }
142     
143     // DEBUG
144
public void print(int depth) {
145         throw new IllegalStateException JavaDoc
146             ("Method must be overridden by subclass" +
147             getClass().getName());
148     }
149 }
150
Popular Tags