T
- the entity typepublic class XmlIoSingleton<T> extends Object
handledTags
. When reading an (the) object from an XML element,
unhandled children of the element are stored. When writing an object to an XML
element these children will be added. This provides a way to read / modify /
write spimdata XML files without knowing the details of possible extensions.Modifier and Type | Field and Description |
---|---|
protected HashSet<String> |
handledTags |
Constructor and Description |
---|
XmlIoSingleton(String tag,
Class<T> klass)
Construct a
XmlIoSingleton that writes and reads objects of the
specified Class as XML elements with the specified tag name. |
Modifier and Type | Method and Description |
---|---|
protected T |
fromXml(org.jdom2.Element elem)
Create an object from the given element.
|
String |
getTag()
Get the tag name of the XML element that is written by this
XmlIoSingleton . |
protected org.jdom2.Element |
toXml()
Create an XML element from the given object.
|
public XmlIoSingleton(String tag, Class<T> klass)
XmlIoSingleton
that writes and reads objects of the
specified Class
as XML elements with the specified tag name. This
takes care of unhandled tags.tag
- the tag name of the XML elements that are written by this
XmlIoEntity
.klass
- the class of the objects that are read by this
XmlIoEntity
.public String getTag()
XmlIoSingleton
.protected org.jdom2.Element toXml()
protected T fromXml(org.jdom2.Element elem) throws SpimDataException
created
.
Calling this method clears all unhandled content from previous
invocations.SpimDataException
Copyright © 2015–2021 Fiji. All rights reserved.