T - the entity typepublic class XmlIoEntity<T extends Entity> extends Object
Entity as XML
elements.
When reading/writing an object, XmlIoEntity takes care of the
id of the object. Other attributes are handled in
derived classes.
Derived classes should add the tag names of children that they handle to the
set handledTags. When reading an object from an XML element,
unhandled children of the element are stored as associated with the objects
id. When writing an object with the same id 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 |
|---|
XmlIoEntity(String tag,
Class<T> klass)
Construct a
XmlIoEntity that writes and reads objects of the
specified Class as XML elements with the specified tag name. |
| Modifier and Type | Method and Description |
|---|---|
T |
fromXml(org.jdom2.Element elem)
Create an object from the given element.
|
Class<T> |
getEntityClass() |
String |
getTag()
Get the tag name of the XML element that is written by this
XmlIoEntity. |
org.jdom2.Element |
toXml(T object)
Create an XML element from the given object.
|
public XmlIoEntity(String tag, Class<T> klass)
XmlIoEntity that writes and reads objects of the
specified Class as XML elements with the specified tag name. This
reads/writes the id of the object. Other
attributes are handled in derived classes.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()
XmlIoEntity.public org.jdom2.Element toXml(T object)
public T fromXml(org.jdom2.Element elem) throws SpimDataException
id and added to any XML element created for that
id.SpimDataExceptionCopyright © 2015–2021 Fiji. All rights reserved.