Skip to content

Commit 7608031

Browse files
committed
added helper method to get supported object types with their XML name mappings
1 parent 0a00f84 commit 7608031

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/main/java/org/xmlobjects/XMLObjects.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,18 @@ public Set<String> getSerializableNamespaces() {
150150
return serializableNamespaces;
151151
}
152152

153+
public Map<Class<?>, Set<QName>> getObjectTypes() {
154+
Map<Class<?>, Set<QName>> objectTypes = new HashMap<>();
155+
for (Map.Entry<String, Map<String, BuilderInfo>> entry : builders.entrySet()) {
156+
for (Map.Entry<String, BuilderInfo> info : entry.getValue().entrySet()) {
157+
objectTypes.computeIfAbsent(info.getValue().objectType, v -> new HashSet<>())
158+
.add(new QName(entry.getKey(), info.getKey()));
159+
}
160+
}
161+
162+
return objectTypes;
163+
}
164+
153165
public <T> T fromXML(XMLReader reader, Class<T> objectType) throws ObjectBuildException, XMLReadException {
154166
T object = null;
155167
int stopAt = 0;

0 commit comments

Comments
 (0)