Skip to content

Package: AttributeBase

AttributeBase

nameinstructionbranchcomplexitylinemethod
AttributeBase()
M: 10 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
AttributeBase(QName, String)
M: 15 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
AttributeBase(String, String)
M: 19 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
AttributeBase(String, String, String)
M: 8 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
AttributeBase(String, String, String, String, String)
M: 31 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 8 C: 0
0%
M: 1 C: 0
0%
getDTDType()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getLocalName()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getName()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getValue()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
isSpecified()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
setAttributeType(String)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setName(QName)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setSpecified(boolean)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setValue(String)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
toString()
M: 43 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3: *
4: * Copyright (c) 2004-2018 Oracle and/or its affiliates. All rights reserved.
5: *
6: * Oracle licenses this file to You under the Apache License, Version 2.0
7: * (the "License"); you may not use this file except in compliance with
8: * the License. You may obtain a copy of the License at
9: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: package com.sun.xml.fastinfoset.stax.events;
20:
21: import javax.xml.namespace.QName;
22: import javax.xml.stream.events.Attribute;
23:
24:
25:
26: public class AttributeBase extends EventBase implements Attribute
27:
28: {
29: //an Attribute consists of a qualified name and value
30: private QName _QName;
31: private String _value;
32:
33: private String _attributeType = null;
34: //A flag indicating whether this attribute was actually specified in the start-tag
35: //of its element or was defaulted from the schema.
36: private boolean _specified = false;
37:
38: public AttributeBase(){
39: super(ATTRIBUTE);
40: }
41:
42: public AttributeBase(String name, String value) {
43: super(ATTRIBUTE);
44: _QName = new QName(name);
45: _value = value;
46: }
47:
48: public AttributeBase(QName qname, String value) {
49: _QName = qname;
50: _value = value;
51: }
52:
53: public AttributeBase(String prefix, String localName, String value) {
54: this(prefix, null,localName, value, null);
55: }
56:
57: public AttributeBase(String prefix, String namespaceURI, String localName,
58: String value, String attributeType) {
59:• if (prefix == null) prefix = "";
60: _QName = new QName(namespaceURI, localName,prefix);
61: _value = value;
62:• _attributeType = (attributeType == null) ? "CDATA":attributeType;
63: }
64:
65:
66: public void setName(QName name){
67: _QName = name ;
68: }
69:
70: /**
71: * Returns the QName for this attribute
72: */
73: public QName getName() {
74: return _QName;
75: }
76:
77: public void setValue(String value){
78: _value = value;
79: }
80:
81: public String getLocalName() {
82: return _QName.getLocalPart();
83: }
84: /**
85: * Gets the normalized value of this attribute
86: */
87: public String getValue() {
88: return _value;
89: }
90:
91: public void setAttributeType(String attributeType){
92: _attributeType = attributeType ;
93: }
94:
95: /**
96: * Gets the type of this attribute, default is
97: * the String "CDATA"
98: * @return the type as a String, default is "CDATA"
99: */
100: public String getDTDType() {
101: return _attributeType;
102: }
103:
104:
105: /**
106: * A flag indicating whether this attribute was actually
107: * specified in the start-tag of its element, or was defaulted from the schema.
108: * @return returns true if this was specified in the start element
109: */
110: public boolean isSpecified() {
111: return _specified ;
112: }
113:
114: public void setSpecified(boolean isSpecified){
115: _specified = isSpecified ;
116: }
117:
118:
119: public String toString() {
120: String prefix = _QName.getPrefix();
121:• if (!Util.isEmptyString(prefix))
122: return prefix + ":" + _QName.getLocalPart() + "='" + _value + "'";
123:
124: return _QName.getLocalPart() + "='" + _value + "'";
125: }
126:
127:
128: }
129: