Skip to content

Commit ac5599c

Browse files
committed
minor change
1 parent e4c84d9 commit ac5599c

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

src/main/java/org/xmlobjects/xml/Attributes.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@
2828
public class Attributes {
2929
private final Map<String, Map<String, TextContent>> attributes = new HashMap<>();
3030

31-
public boolean isEmpty() {
32-
return attributes.isEmpty();
33-
}
34-
3531
public void add(String namespaceURI, String localName, TextContent value) {
3632
attributes.computeIfAbsent(namespaceURI, v -> new HashMap<>()).put(localName, value);
3733
}
@@ -60,6 +56,18 @@ public void addAll(String namespaceURI, Map<String, TextContent> attributes) {
6056
this.attributes.computeIfAbsent(namespaceURI, v -> new HashMap<>()).putAll(attributes);
6157
}
6258

59+
public boolean contains(String localName) {
60+
return contains(XMLConstants.NULL_NS_URI, localName);
61+
}
62+
63+
public boolean contains(QName name) {
64+
return contains(name.getNamespaceURI(), name.getLocalPart());
65+
}
66+
67+
public boolean contains(String namespaceURI, String localName) {
68+
return get(namespaceURI).containsKey(localName);
69+
}
70+
6371
public Map<String, Map<String, TextContent>> get() {
6472
return attributes;
6573
}
@@ -80,6 +88,10 @@ public TextContent getValue(QName name) {
8088
return getValue(name.getNamespaceURI(), name.getLocalPart());
8189
}
8290

91+
public boolean isEmpty() {
92+
return attributes.isEmpty();
93+
}
94+
8395
public Attributes copy() {
8496
Attributes copy = new Attributes();
8597
copy.attributes.putAll(attributes);

src/main/java/org/xmlobjects/xml/TextContent.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ public boolean isAbsent() {
219219
return this == ABSENT;
220220
}
221221

222+
public boolean isEmpty() {
223+
return this != ABSENT && content.isEmpty();
224+
}
225+
222226
public TextContent trim() {
223227
if (isPresent()) {
224228
content = trimContent();

0 commit comments

Comments
 (0)