Source code: org/hibernate/proxy/dom4j/Dom4jProxy.java
1 // $Id: Dom4jProxy.java 9210 2006-02-03 22:15:19Z steveebersole $
2 package org.hibernate.proxy.dom4j;
3
4 import org.dom4j.Element;
5 import org.dom4j.QName;
6 import org.dom4j.Namespace;
7 import org.dom4j.Attribute;
8 import org.dom4j.CDATA;
9 import org.dom4j.Entity;
10 import org.dom4j.Text;
11 import org.dom4j.Node;
12 import org.dom4j.Branch;
13 import org.dom4j.ProcessingInstruction;
14 import org.dom4j.Comment;
15 import org.dom4j.Document;
16 import org.dom4j.XPath;
17 import org.dom4j.InvalidXPathException;
18 import org.dom4j.Visitor;
19 import org.hibernate.proxy.dom4j.Dom4jLazyInitializer;
20 import org.hibernate.proxy.HibernateProxy;
21 import org.hibernate.proxy.LazyInitializer;
22
23 import java.io.Serializable;
24 import java.io.Writer;
25 import java.io.IOException;
26 import java.util.List;
27 import java.util.Map;
28 import java.util.Iterator;
29
30 /**
31 * Proxy for "dom4j" entity representations.
32 *
33 * @author Steve Ebersole
34 */
35 public class Dom4jProxy implements HibernateProxy, Element, Serializable {
36
37 private Dom4jLazyInitializer li;
38
39 public Dom4jProxy(Dom4jLazyInitializer li) {
40 this.li = li;
41 }
42
43 public Object writeReplace() {
44 return this;
45 }
46
47 public LazyInitializer getHibernateLazyInitializer() {
48 return li;
49 }
50
51 public QName getQName() {
52 return target().getQName();
53 }
54
55 public QName getQName(String s) {
56 return target().getQName( s );
57 }
58
59 public void setQName(QName qName) {
60 target().setQName( qName );
61 }
62
63 public Namespace getNamespace() {
64 return target().getNamespace();
65 }
66
67 public Namespace getNamespaceForPrefix(String s) {
68 return target().getNamespaceForPrefix( s );
69 }
70
71 public Namespace getNamespaceForURI(String s) {
72 return target().getNamespaceForURI( s );
73 }
74
75 public List getNamespacesForURI(String s) {
76 return target().getNamespacesForURI( s );
77 }
78
79 public String getNamespacePrefix() {
80 return target().getNamespacePrefix();
81 }
82
83 public String getNamespaceURI() {
84 return target().getNamespaceURI();
85 }
86
87 public String getQualifiedName() {
88 return target().getQualifiedName();
89 }
90
91 public List additionalNamespaces() {
92 return target().additionalNamespaces();
93 }
94
95 public List declaredNamespaces() {
96 return target().declaredNamespaces();
97 }
98
99 public Element addAttribute(String attrName, String text) {
100 return target().addAttribute( attrName, text );
101 }
102
103 public Element addAttribute(QName attrName, String text) {
104 return target().addAttribute( attrName, text );
105 }
106
107 public Element addComment(String text) {
108 return target().addComment( text );
109 }
110
111 public Element addCDATA(String text) {
112 return target().addCDATA( text );
113 }
114
115 public Element addEntity(String name, String text) {
116 return target().addEntity( name, text );
117 }
118
119 public Element addNamespace(String prefix, String uri) {
120 return target().addNamespace( prefix, uri );
121 }
122
123 public Element addProcessingInstruction(String target, String text) {
124 return target().addProcessingInstruction( target, text );
125 }
126
127 public Element addProcessingInstruction(String target, Map data) {
128 return target().addProcessingInstruction( target, data );
129 }
130
131 public Element addText(String text) {
132 return target().addText( text );
133 }
134
135 public void add(Attribute attribute) {
136 target().add( attribute );
137 }
138
139 public void add(CDATA cdata) {
140 target().add( cdata );
141 }
142
143 public void add(Entity entity) {
144 target().add( entity );
145 }
146
147 public void add(Text text) {
148 target().add( text );
149 }
150
151 public void add(Namespace namespace) {
152 target().add( namespace );
153 }
154
155 public boolean remove(Attribute attribute) {
156 return target().remove( attribute );
157 }
158
159 public boolean remove(CDATA cdata) {
160 return target().remove( cdata );
161 }
162
163 public boolean remove(Entity entity) {
164 return target().remove( entity );
165 }
166
167 public boolean remove(Namespace namespace) {
168 return target().remove( namespace );
169 }
170
171 public boolean remove(Text text) {
172 return target().remove( text );
173 }
174
175 public boolean supportsParent() {
176 return target().supportsParent();
177 }
178
179 public Element getParent() {
180 return target().getParent();
181 }
182
183 public void setParent(Element element) {
184 target().setParent( element );
185 }
186
187 public Document getDocument() {
188 return target().getDocument();
189 }
190
191 public void setDocument(Document document) {
192 target().setDocument( document );
193 }
194
195 public boolean isReadOnly() {
196 return target().isReadOnly();
197 }
198
199 public boolean hasContent() {
200 return target().hasContent();
201 }
202
203 public String getName() {
204 return target().getName();
205 }
206
207 public void setName(String name) {
208 target().setName( name );
209 }
210
211 public String getText() {
212 return target().getText();
213 }
214
215 public void setText(String text) {
216 target().setText( text );
217 }
218
219 public String getTextTrim() {
220 return target().getTextTrim();
221 }
222
223 public String getStringValue() {
224 return target().getStringValue();
225 }
226
227 public String getPath() {
228 return target().getPath();
229 }
230
231 public String getPath(Element element) {
232 return target().getPath( element );
233 }
234
235 public String getUniquePath() {
236 return target().getUniquePath();
237 }
238
239 public String getUniquePath(Element element) {
240 return target().getUniquePath( element );
241 }
242
243 public String asXML() {
244 return target().asXML();
245 }
246
247 public void write(Writer writer) throws IOException {
248 target().write( writer );
249 }
250
251 public short getNodeType() {
252 return target().getNodeType();
253 }
254
255 public String getNodeTypeName() {
256 return target().getNodeTypeName();
257 }
258
259 public Node detach() {
260 Element parent = target().getParent();
261 if (parent!=null) parent.remove(this);
262 return target().detach();
263 }
264
265 public List selectNodes(String xpath) {
266 return target().selectNodes( xpath );
267 }
268
269 public Object selectObject(String xpath) {
270 return target().selectObject( xpath );
271 }
272
273 public List selectNodes(String xpath, String comparison) {
274 return target().selectNodes( xpath, comparison );
275 }
276
277 public List selectNodes(String xpath, String comparison, boolean removeDups) {
278 return target().selectNodes( xpath, comparison, removeDups );
279 }
280
281 public Node selectSingleNode(String xpath) {
282 return target().selectSingleNode( xpath );
283 }
284
285 public String valueOf(String xpath) {
286 return target().valueOf( xpath );
287 }
288
289 public Number numberValueOf(String xpath) {
290 return target().numberValueOf( xpath );
291 }
292
293 public boolean matches(String xpath) {
294 return target().matches( xpath );
295 }
296
297 public XPath createXPath(String xpath) throws InvalidXPathException {
298 return target().createXPath( xpath );
299 }
300
301 public Node asXPathResult(Element element) {
302 return target().asXPathResult( element );
303 }
304
305 public void accept(Visitor visitor) {
306 target().accept( visitor );
307 }
308
309 public Object clone() {
310 return target().clone();
311 }
312
313 public Object getData() {
314 return target().getData();
315 }
316
317 public void setData(Object data) {
318 target().setData( data );
319 }
320
321 public List attributes() {
322 return target().attributes();
323 }
324
325 public void setAttributes(List list) {
326 target().setAttributes( list );
327 }
328
329 public int attributeCount() {
330 return target().attributeCount();
331 }
332
333 public Iterator attributeIterator() {
334 return target().attributeIterator();
335 }
336
337 public Attribute attribute(int i) {
338 return target().attribute( i );
339 }
340
341 public Attribute attribute(String name) {
342 return target().attribute( name );
343 }
344
345 public Attribute attribute(QName qName) {
346 return target().attribute( qName );
347 }
348
349 public String attributeValue(String name) {
350 return target().attributeValue( name );
351 }
352
353 public String attributeValue(String name, String defaultValue) {
354 return target().attributeValue( name, defaultValue );
355 }
356
357 public String attributeValue(QName qName) {
358 return target().attributeValue( qName );
359 }
360
361 public String attributeValue(QName qName, String defaultValue) {
362 return target().attributeValue( qName, defaultValue );
363 }
364
365 /**
366 * @deprecated
367 */
368 public void setAttributeValue(String name, String value) {
369 target().setAttributeValue( name, value );
370 }
371
372 /**
373 * @deprecated
374 */
375 public void setAttributeValue(QName qName, String value) {
376 target().setAttributeValue( qName, value );
377 }
378
379 public Element element(String name) {
380 return target().element( name );
381 }
382
383 public Element element(QName qName) {
384 return target().element( qName );
385 }
386
387 public List elements() {
388 return target().elements();
389 }
390
391 public List elements(String name) {
392 return target().elements( name );
393 }
394
395 public List elements(QName qName) {
396 return target().elements( qName );
397 }
398
399 public Iterator elementIterator() {
400 return target().elementIterator();
401 }
402
403 public Iterator elementIterator(String name) {
404 return target().elementIterator( name );
405
406 }
407
408 public Iterator elementIterator(QName qName) {
409 return target().elementIterator( qName );
410 }
411
412 public boolean isRootElement() {
413 return target().isRootElement();
414 }
415
416 public boolean hasMixedContent() {
417 return target().hasMixedContent();
418 }
419
420 public boolean isTextOnly() {
421 return target().isTextOnly();
422 }
423
424 public void appendAttributes(Element element) {
425 target().appendAttributes( element );
426 }
427
428 public Element createCopy() {
429 return target().createCopy();
430 }
431
432 public Element createCopy(String name) {
433 return target().createCopy( name );
434 }
435
436 public Element createCopy(QName qName) {
437 return target().createCopy( qName );
438 }
439
440 public String elementText(String name) {
441 return target().elementText( name );
442 }
443
444 public String elementText(QName qName) {
445 return target().elementText( qName );
446 }
447
448 public String elementTextTrim(String name) {
449 return target().elementTextTrim( name );
450 }
451
452 public String elementTextTrim(QName qName) {
453 return target().elementTextTrim( qName );
454 }
455
456 public Node getXPathResult(int i) {
457 return target().getXPathResult( i );
458 }
459
460 public Node node(int i) {
461 return target().node( i );
462 }
463
464 public int indexOf(Node node) {
465 return target().indexOf( node );
466 }
467
468 public int nodeCount() {
469 return target().nodeCount();
470 }
471
472 public Element elementByID(String id) {
473 return target().elementByID( id );
474 }
475
476 public List content() {
477 return target().content();
478 }
479
480 public Iterator nodeIterator() {
481 return target().nodeIterator();
482 }
483
484 public void setContent(List list) {
485 target().setContent( list );
486 }
487
488 public void appendContent(Branch branch) {
489 target().appendContent( branch );
490 }
491
492 public void clearContent() {
493 target().clearContent();
494 }
495
496 public List processingInstructions() {
497 return target().processingInstructions();
498 }
499
500 public List processingInstructions(String name) {
501 return target().processingInstructions( name );
502 }
503
504 public ProcessingInstruction processingInstruction(String name) {
505 return target().processingInstruction( name );
506 }
507
508 public void setProcessingInstructions(List list) {
509 target().setProcessingInstructions( list );
510 }
511
512 public Element addElement(String name) {
513 return target().addElement( name );
514 }
515
516 public Element addElement(QName qName) {
517 return target().addElement( qName );
518 }
519
520 public Element addElement(String name, String text) {
521 return target().addElement( name, text );
522
523 }
524
525 public boolean removeProcessingInstruction(String name) {
526 return target().removeProcessingInstruction( name );
527 }
528
529 public void add(Node node) {
530 target().add( node );
531 }
532
533 public void add(Comment comment) {
534 target().add( comment );
535 }
536
537 public void add(Element element) {
538 target().add( element );
539 }
540
541 public void add(ProcessingInstruction processingInstruction) {
542 target().add( processingInstruction );
543 }
544
545 public boolean remove(Node node) {
546 return target().remove( node );
547 }
548
549 public boolean remove(Comment comment) {
550 return target().remove( comment );
551 }
552
553 public boolean remove(Element element) {
554 return target().remove( element );
555 }
556
557 public boolean remove(ProcessingInstruction processingInstruction) {
558 return target().remove( processingInstruction );
559 }
560
561 public void normalize() {
562 target().normalize();
563 }
564
565 private Element target() {
566 return li.getElement();
567 }
568 }