KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > om > impl > llom > OMAttributeImpl


1 /*
2  * Copyright 2004,2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.axis2.om.impl.llom;
17
18 import org.apache.axis2.om.OMAttribute;
19 import org.apache.axis2.om.OMNamespace;
20
21 import javax.xml.namespace.QName JavaDoc;
22 import java.util.regex.Matcher JavaDoc;
23 import java.util.regex.Pattern JavaDoc;
24
25 /**
26  * Class OMAttributeImpl
27  */

28 public class OMAttributeImpl implements OMAttribute {
29     /**
30      * Field localName
31      */

32     private String JavaDoc localName;
33
34     /**
35      * Field value
36      */

37     private String JavaDoc value;
38
39     /**
40      * Field namespace
41      */

42     private OMNamespace namespace;
43
44     /**
45      * Field QUOTE_ENTITY
46      */

47     private static String JavaDoc QUOTE_ENTITY = """;
48
49     /**
50      * Field matcher
51      */

52     private static Matcher JavaDoc matcher = Pattern.compile("\"").matcher(null);
53
54     /**
55      * Constructor OMAttributeImpl
56      *
57      * @param localName
58      * @param ns
59      * @param value
60      */

61     public OMAttributeImpl(String JavaDoc localName, OMNamespace ns, String JavaDoc value) {
62         setLocalName(localName);
63         setValue(value);
64         setOMNamespace(ns);
65     }
66
67     /**
68      * Method getQName
69      *
70      * @return
71      */

72     public QName JavaDoc getQName() {
73         String JavaDoc namespaceName = (namespace != null)
74                 ? namespace.getName()
75                 : null;
76         return new QName JavaDoc(namespaceName, localName);
77     }
78
79     // -------- Getters and Setters
80

81     /**
82      * Method getLocalName
83      *
84      * @return
85      */

86     public String JavaDoc getLocalName() {
87         return localName;
88     }
89
90     /**
91      * Method setLocalName
92      *
93      * @param localName
94      */

95     public void setLocalName(String JavaDoc localName) {
96         this.localName = localName;
97     }
98
99     /**
100      * Method getValue
101      *
102      * @return
103      */

104     public String JavaDoc getValue() {
105         return value;
106     }
107
108     /**
109      * Method setValue
110      *
111      * @param value
112      */

113     public void setValue(String JavaDoc value) {
114         this.value = value;
115     }
116
117     /**
118      * Method setOMNamespace
119      *
120      * @param omNamespace
121      */

122     public void setOMNamespace(OMNamespace omNamespace) {
123         this.namespace = omNamespace;
124     }
125
126     /**
127      * Method getNamespace
128      *
129      * @return
130      */

131     public OMNamespace getNamespace() {
132         return namespace;
133     }
134 }
135
Popular Tags