Package jmri.configurexml
Class DefaultJavaBeanConfigXML
- java.lang.Object
-
- jmri.configurexml.AbstractXmlAdapter
-
- jmri.configurexml.DefaultJavaBeanConfigXML
-
- All Implemented Interfaces:
XmlAdapter
public class DefaultJavaBeanConfigXML extends AbstractXmlAdapter
Provides services for storing Java Beans to XML using reflection.- Since:
- 2.3.1
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jmri.configurexml.AbstractXmlAdapter
AbstractXmlAdapter.EnumIO<T extends java.lang.Enum<T>>, AbstractXmlAdapter.EnumIoMapped<T extends java.lang.Enum<T>>, AbstractXmlAdapter.EnumIoNames<T extends java.lang.Enum<T>>, AbstractXmlAdapter.EnumIoNamesNumbers<T extends java.lang.Enum<T>>, AbstractXmlAdapter.EnumIoOrdinals<T extends java.lang.Enum<T>>
-
-
Constructor Summary
Constructors Constructor Description DefaultJavaBeanConfigXML()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) boolean
getAttributeBool(org.jdom2.Element elem, java.lang.String name, boolean def)
Get an attribute boolean value from an Element defining a NamedBean(package private) java.lang.String
getAttributeString(org.jdom2.Element elem, java.lang.String name)
Get an attribute string value from an Element defining a NamedBeanvoid
load(org.jdom2.Element e, java.lang.Object o)
Create a set of configured objects from their XML description, using an auxiliary object.boolean
load(org.jdom2.Element shared, org.jdom2.Element perNode)
Create a set of configured objects from their XML description.org.jdom2.Element
store(java.lang.Object o)
Store the object in XML(package private) java.lang.Object
unpack(org.jdom2.Element e)
-
Methods inherited from class jmri.configurexml.AbstractXmlAdapter
getAttributeBooleanValue, getAttributeDoubleValue, getAttributeFloatValue, getAttributeIntegerValue, getExceptionHandler, handleException, load, load, loadDeferred, loadOrder, setExceptionHandler, store
-
-
-
-
Constructor Detail
-
DefaultJavaBeanConfigXML
public DefaultJavaBeanConfigXML()
-
-
Method Detail
-
load
public boolean load(org.jdom2.Element shared, org.jdom2.Element perNode)
Description copied from class:AbstractXmlAdapter
Create a set of configured objects from their XML description.- Specified by:
load
in interfaceXmlAdapter
- Overrides:
load
in classAbstractXmlAdapter
- Parameters:
shared
- Top-level XML element containing the common, multi-node elements of the descriptionperNode
- Top-level XML element containing the private, single-node elements of the description- Returns:
- true if successful
-
load
public void load(org.jdom2.Element e, java.lang.Object o)
Description copied from class:AbstractXmlAdapter
Create a set of configured objects from their XML description, using an auxiliary object.For example, the auxilary object o might be a manager or GUI of some type that needs to be informed as each object is created.
- Specified by:
load
in interfaceXmlAdapter
- Overrides:
load
in classAbstractXmlAdapter
- Parameters:
e
- Top-level XML element containing the descriptiono
- Implementation-specific Object needed for the conversion
-
unpack
java.lang.Object unpack(org.jdom2.Element e) throws java.lang.ClassNotFoundException, java.lang.NoSuchMethodException, java.lang.InstantiationException, java.beans.IntrospectionException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
- Throws:
java.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.InstantiationException
java.beans.IntrospectionException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
-
store
public org.jdom2.Element store(java.lang.Object o)
Description copied from interface:XmlAdapter
Store the object in XML- Parameters:
o
- The object to be recorded. Specific XmlAdapter implementations will require this to be of a specific type; that binding is done in ConfigXmlManager.- Returns:
- The XML representation Element
-
getAttributeString
java.lang.String getAttributeString(org.jdom2.Element elem, java.lang.String name)
Get an attribute string value from an Element defining a NamedBean- Parameters:
elem
- The existing Elementname
- name of desired Attribute- Returns:
- the attribute string or null if name is not an attribute of elem
-
getAttributeBool
boolean getAttributeBool(org.jdom2.Element elem, java.lang.String name, boolean def)
Get an attribute boolean value from an Element defining a NamedBean- Parameters:
elem
- The existing Elementname
- Name of desired Attributedef
- Default value for attribute- Returns:
- value of name or def if name is not an attribute of elem
-
-