KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > tuple > ElementWrapper


1 // $Id: ElementWrapper.java,v 1.2 2005/04/29 03:06:37 oneovthafew Exp $
2
package org.hibernate.tuple;
3
4 import java.io.IOException JavaDoc;
5 import java.io.Serializable JavaDoc;
6 import java.io.Writer JavaDoc;
7 import java.util.Iterator JavaDoc;
8 import java.util.List JavaDoc;
9 import java.util.Map JavaDoc;
10
11 import org.dom4j.Attribute;
12 import org.dom4j.Branch;
13 import org.dom4j.CDATA;
14 import org.dom4j.Comment;
15 import org.dom4j.Document;
16 import org.dom4j.Element;
17 import org.dom4j.Entity;
18 import org.dom4j.InvalidXPathException;
19 import org.dom4j.Namespace;
20 import org.dom4j.Node;
21 import org.dom4j.ProcessingInstruction;
22 import org.dom4j.QName;
23 import org.dom4j.Text;
24 import org.dom4j.Visitor;
25 import org.dom4j.XPath;
26
27 /**
28  * Wraps dom4j elements, allowing them to exist in a
29  * non-hierarchical structure.
30  *
31  * @author Gavin King
32  */

33 public class ElementWrapper implements Element, Serializable JavaDoc {
34
35     private Element element;
36     private Element parent;
37     
38     public Element getElement() {
39         return element;
40     }
41
42     public ElementWrapper(Element element) {
43         this.element = element;
44     }
45
46     public QName getQName() {
47         return element.getQName();
48     }
49
50     public QName getQName(String JavaDoc s) {
51         return element.getQName( s );
52     }
53
54     public void setQName(QName qName) {
55         element.setQName( qName );
56     }
57
58     public Namespace getNamespace() {
59         return element.getNamespace();
60     }
61
62     public Namespace getNamespaceForPrefix(String JavaDoc s) {
63         return element.getNamespaceForPrefix( s );
64     }
65
66     public Namespace getNamespaceForURI(String JavaDoc s) {
67         return element.getNamespaceForURI( s );
68     }
69
70     public List JavaDoc getNamespacesForURI(String JavaDoc s) {
71         return element.getNamespacesForURI( s );
72     }
73
74     public String JavaDoc getNamespacePrefix() {
75         return element.getNamespacePrefix();
76     }
77
78     public String JavaDoc getNamespaceURI() {
79         return element.getNamespaceURI();
80     }
81
82     public String JavaDoc getQualifiedName() {
83         return element.getQualifiedName();
84     }
85
86     public List JavaDoc additionalNamespaces() {
87         return element.additionalNamespaces();
88     }
89
90     public List JavaDoc declaredNamespaces() {
91         return element.declaredNamespaces();
92     }
93
94     public Element addAttribute(String JavaDoc attrName, String JavaDoc text) {
95         return element.addAttribute( attrName, text );
96     }
97
98     public Element addAttribute(QName attrName, String JavaDoc text) {
99         return element.addAttribute( attrName, text );
100     }
101
102     public Element addComment(String JavaDoc text) {
103         return element.addComment( text );
104     }
105
106     public Element addCDATA(String JavaDoc text) {
107         return element.addCDATA( text );
108     }
109
110     public Element addEntity(String JavaDoc name, String JavaDoc text) {
111         return element.addEntity( name, text );
112     }
113
114     public Element addNamespace(String JavaDoc prefix, String JavaDoc uri) {
115         return element.addNamespace( prefix, uri );
116     }
117
118     public Element addProcessingInstruction(String JavaDoc target, String JavaDoc text) {
119         return element.addProcessingInstruction( target, text );
120     }
121
122     public Element addProcessingInstruction(String JavaDoc target, Map JavaDoc data) {
123         return element.addProcessingInstruction( target, data );
124     }
125
126     public Element addText(String JavaDoc text) {
127         return element.addText( text );
128     }
129
130     public void add(Attribute attribute) {
131         element.add( attribute );
132     }
133
134     public void add(CDATA cdata) {
135         element.add( cdata );
136     }
137
138     public void add(Entity entity) {
139         element.add( entity );
140     }
141
142     public void add(Text text) {
143         element.add( text );
144     }
145
146     public void add(Namespace namespace) {
147         element.add( namespace );
148     }
149
150     public boolean remove(Attribute attribute) {
151         return element.remove( attribute );
152     }
153
154     public boolean remove(CDATA cdata) {
155         return element.remove( cdata );
156     }
157
158     public boolean remove(Entity entity) {
159         return element.remove( entity );
160     }
161
162     public boolean remove(Namespace namespace) {
163         return element.remove( namespace );
164     }
165
166     public boolean remove(Text text) {
167         return element.remove( text );
168     }
169
170     public boolean supportsParent() {
171         return element.supportsParent();
172     }
173
174     public Element getParent() {
175         return parent==null ? element.getParent() : parent;
176     }
177
178     public void setParent(Element parent) {
179         element.setParent( parent );
180         this.parent = parent;
181     }
182
183     public Document getDocument() {
184         return element.getDocument();
185     }
186
187     public void setDocument(Document document) {
188         element.setDocument( document );
189     }
190
191     public boolean isReadOnly() {
192         return element.isReadOnly();
193     }
194
195     public boolean hasContent() {
196         return element.hasContent();
197     }
198
199     public String JavaDoc getName() {
200         return element.getName();
201     }
202
203     public void setName(String JavaDoc name) {
204         element.setName( name );
205     }
206
207     public String JavaDoc getText() {
208         return element.getText();
209     }
210
211     public void setText(String JavaDoc text) {
212         element.setText( text );
213     }
214
215     public String JavaDoc getTextTrim() {
216         return element.getTextTrim();
217     }
218
219     public String JavaDoc getStringValue() {
220         return element.getStringValue();
221     }
222
223     public String JavaDoc getPath() {
224         return element.getPath();
225     }
226
227     public String JavaDoc getPath(Element element) {
228         return element.getPath( element );
229     }
230
231     public String JavaDoc getUniquePath() {
232         return element.getUniquePath();
233     }
234
235     public String JavaDoc getUniquePath(Element element) {
236         return element.getUniquePath( element );
237     }
238
239     public String JavaDoc asXML() {
240         return element.asXML();
241     }
242
243     public void write(Writer JavaDoc writer) throws IOException JavaDoc {
244         element.write( writer );
245     }
246
247     public short getNodeType() {
248         return element.getNodeType();
249     }
250
251     public String JavaDoc getNodeTypeName() {
252         return element.getNodeTypeName();
253     }
254
255     public Node detach() {
256         if (parent!=null) {
257             parent.remove(this);
258             parent = null;
259         }
260         return element.detach();
261     }
262
263     public List JavaDoc selectNodes(String JavaDoc xpath) {
264         return element.selectNodes( xpath );
265     }
266
267     public Object JavaDoc selectObject(String JavaDoc xpath) {
268         return element.selectObject( xpath );
269     }
270
271     public List JavaDoc selectNodes(String JavaDoc xpath, String JavaDoc comparison) {
272         return element.selectNodes( xpath, comparison );
273     }
274
275     public List JavaDoc selectNodes(String JavaDoc xpath, String JavaDoc comparison, boolean removeDups) {
276         return element.selectNodes( xpath, comparison, removeDups );
277     }
278
279     public Node selectSingleNode(String JavaDoc xpath) {
280         return element.selectSingleNode( xpath );
281     }
282
283     public String JavaDoc valueOf(String JavaDoc xpath) {
284         return element.valueOf( xpath );
285     }
286
287     public Number JavaDoc numberValueOf(String JavaDoc xpath) {
288         return element.numberValueOf( xpath );
289     }
290
291     public boolean matches(String JavaDoc xpath) {
292         return element.matches( xpath );
293     }
294
295     public XPath createXPath(String JavaDoc xpath) throws InvalidXPathException {
296         return element.createXPath( xpath );
297     }
298
299     public Node asXPathResult(Element element) {
300         return element.asXPathResult( element );
301     }
302
303     public void accept(Visitor visitor) {
304         element.accept( visitor );
305     }
306
307     public Object JavaDoc clone() {
308         return element.clone();
309     }
310
311     public Object JavaDoc getData() {
312         return element.getData();
313     }
314
315     public void setData(Object JavaDoc data) {
316         element.setData( data );
317     }
318
319     public List JavaDoc attributes() {
320         return element.attributes();
321     }
322
323     public void setAttributes(List JavaDoc list) {
324         element.setAttributes( list );
325     }
326
327     public int attributeCount() {
328         return element.attributeCount();
329     }
330
331     public Iterator JavaDoc attributeIterator() {
332         return element.attributeIterator();
333     }
334
335     public Attribute attribute(int i) {
336         return element.attribute( i );
337     }
338
339     public Attribute attribute(String JavaDoc name) {
340         return element.attribute( name );
341     }
342
343     public Attribute attribute(QName qName) {
344         return element.attribute( qName );
345     }
346
347     public String JavaDoc attributeValue(String JavaDoc name) {
348         return element.attributeValue( name );
349     }
350
351     public String JavaDoc attributeValue(String JavaDoc name, String JavaDoc defaultValue) {
352         return element.attributeValue( name, defaultValue );
353     }
354
355     public String JavaDoc attributeValue(QName qName) {
356         return element.attributeValue( qName );
357     }
358
359     public String JavaDoc attributeValue(QName qName, String JavaDoc defaultValue) {
360         return element.attributeValue( qName, defaultValue );
361     }
362
363     /**
364      * @deprecated
365      */

366     public void setAttributeValue(String JavaDoc name, String JavaDoc value) {
367         element.setAttributeValue( name, value );
368     }
369
370     /**
371      * @deprecated
372      */

373     public void setAttributeValue(QName qName, String JavaDoc value) {
374         element.setAttributeValue( qName, value );
375     }
376
377     public Element element(String JavaDoc name) {
378         return element.element( name );
379     }
380
381     public Element element(QName qName) {
382         return element.element( qName );
383     }
384
385     public List JavaDoc elements() {
386         return element.elements();
387     }
388
389     public List JavaDoc elements(String JavaDoc name) {
390         return element.elements( name );
391     }
392
393     public List JavaDoc elements(QName qName) {
394         return element.elements( qName );
395     }
396
397     public Iterator JavaDoc elementIterator() {
398         return element.elementIterator();
399     }
400
401     public Iterator JavaDoc elementIterator(String JavaDoc name) {
402         return element.elementIterator( name );
403
404     }
405
406     public Iterator JavaDoc elementIterator(QName qName) {
407         return element.elementIterator( qName );
408     }
409
410     public boolean isRootElement() {
411         return element.isRootElement();
412     }
413
414     public boolean hasMixedContent() {
415         return element.hasMixedContent();
416     }
417
418     public boolean isTextOnly() {
419         return element.isTextOnly();
420     }
421
422     public void appendAttributes(Element element) {
423         element.appendAttributes( element );
424     }
425
426     public Element createCopy() {
427         return element.createCopy();
428     }
429
430     public Element createCopy(String JavaDoc name) {
431         return element.createCopy( name );
432     }
433
434     public Element createCopy(QName qName) {
435         return element.createCopy( qName );
436     }
437
438     public String JavaDoc elementText(String JavaDoc name) {
439         return element.elementText( name );
440     }
441
442     public String JavaDoc elementText(QName qName) {
443         return element.elementText( qName );
444     }
445
446     public String JavaDoc elementTextTrim(String JavaDoc name) {
447         return element.elementTextTrim( name );
448     }
449
450     public String JavaDoc elementTextTrim(QName qName) {
451         return element.elementTextTrim( qName );
452     }
453
454     public Node getXPathResult(int i) {
455         return element.getXPathResult( i );
456     }
457
458     public Node node(int i) {
459         return element.node( i );
460     }
461
462     public int indexOf(Node node) {
463         return element.indexOf( node );
464     }
465
466     public int nodeCount() {
467         return element.nodeCount();
468     }
469
470     public Element elementByID(String JavaDoc id) {
471         return element.elementByID( id );
472     }
473
474     public List JavaDoc content() {
475         return element.content();
476     }
477
478     public Iterator JavaDoc nodeIterator() {
479         return element.nodeIterator();
480     }
481
482     public void setContent(List JavaDoc list) {
483         element.setContent( list );
484     }
485
486     public void appendContent(Branch branch) {
487         element.appendContent( branch );
488     }
489
490     public void clearContent() {
491         element.clearContent();
492     }
493
494     public List JavaDoc processingInstructions() {
495         return element.processingInstructions();
496     }
497
498     public List JavaDoc processingInstructions(String JavaDoc name) {
499         return element.processingInstructions( name );
500     }
501
502     public ProcessingInstruction processingInstruction(String JavaDoc name) {
503         return element.processingInstruction( name );
504     }
505
506     public void setProcessingInstructions(List JavaDoc list) {
507         element.setProcessingInstructions( list );
508     }
509
510     public Element addElement(String JavaDoc name) {
511         return element.addElement( name );
512     }
513
514     public Element addElement(QName qName) {
515         return element.addElement( qName );
516     }
517
518     public Element addElement(String JavaDoc name, String JavaDoc text) {
519         return element.addElement( name, text );
520
521     }
522
523     public boolean removeProcessingInstruction(String JavaDoc name) {
524         return element.removeProcessingInstruction( name );
525     }
526
527     public void add(Node node) {
528         element.add( node );
529     }
530
531     public void add(Comment comment) {
532         element.add( comment );
533     }
534
535     public void add(Element element) {
536         element.add( element );
537     }
538
539     public void add(ProcessingInstruction processingInstruction) {
540         element.add( processingInstruction );
541     }
542
543     public boolean remove(Node node) {
544         return element.remove( node );
545     }
546
547     public boolean remove(Comment comment) {
548         return element.remove( comment );
549     }
550
551     public boolean remove(Element element) {
552         return element.remove( element );
553     }
554
555     public boolean remove(ProcessingInstruction processingInstruction) {
556         return element.remove( processingInstruction );
557     }
558
559     public void normalize() {
560         element.normalize();
561     }
562     
563     public boolean equals(Object JavaDoc other) {
564         return element.equals(other);
565     }
566     
567     public int hashCode() {
568         return element.hashCode();
569     }
570     
571     public String JavaDoc toString() {
572         return element.toString();
573     }
574
575 }
576
Popular Tags