1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.struts2.views.xslt;
22
23 import org.w3c.dom.Attr;
24 import org.w3c.dom.DOMException;
25 import org.w3c.dom.Element;
26 import org.w3c.dom.TypeInfo;
27
28 /***
29 * ProxyAttrAdapter is a pass-through adapter for objects which already
30 * implement the Attr interface. All methods are proxied to the underlying
31 * Node except node traversal (e.g. getParent()) related methods which
32 * are implemented by the abstract adapter node to work with the parent adapter.
33 */
34 public class ProxyAttrAdapter extends ProxyNodeAdapter implements Attr {
35
36 public ProxyAttrAdapter(AdapterFactory factory, AdapterNode parent, Attr value) {
37 super(factory, parent, value);
38 }
39
40
41 protected Attr attr() {
42 return (Attr) getPropertyValue();
43 }
44
45
46
47 public String getName() {
48 return attr().getName();
49 }
50
51 public boolean getSpecified() {
52 return attr().getSpecified();
53 }
54
55 public String getValue() {
56 return attr().getValue();
57 }
58
59 public void setValue(String string) throws DOMException {
60 throw new UnsupportedOperationException();
61 }
62
63 public Element getOwnerElement() {
64 return (Element) getParent();
65 }
66
67
68
69 public TypeInfo getSchemaTypeInfo() {
70 throw operationNotSupported();
71 }
72
73 public boolean isId() {
74 throw operationNotSupported();
75 }
76
77
78
79
80
81 public String toString() {
82 return "ProxyAttribute for: " + attr();
83 }
84 }
85