Package jmri.configurexml
Class DefaultJavaBeanConfigXML
java.lang.Object
jmri.configurexml.AbstractXmlAdapter
jmri.configurexml.DefaultJavaBeanConfigXML
- All Implemented Interfaces:
XmlAdapter
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 Enum<T>>, AbstractXmlAdapter.EnumIoMapped<T extends Enum<T>>, AbstractXmlAdapter.EnumIoNames<T extends Enum<T>>, AbstractXmlAdapter.EnumIoNamesNumbers<T extends Enum<T>>, AbstractXmlAdapter.EnumIoOrdinals<T extends Enum<T>> -
Field Summary
Fields inherited from class jmri.configurexml.AbstractXmlAdapter
STR_FALSE, STR_NO, STR_TRUE, STR_YES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) booleangetAttributeBool(org.jdom2.Element elem, String name, boolean def) Get an attribute boolean value from an Element defining a NamedBean(package private) StringgetAttributeString(org.jdom2.Element elem, String name) Get an attribute string value from an Element defining a NamedBeanvoidCreate a set of configured objects from their XML description, using an auxiliary object.booleanload(org.jdom2.Element shared, org.jdom2.Element perNode) Create a set of configured objects from their XML description.org.jdom2.ElementStore the object in XML(package private) Objectunpack(org.jdom2.Element e) Methods inherited from class jmri.configurexml.AbstractXmlAdapter
getAttributeBooleanValue, getAttributeDoubleValue, getAttributeFloatValue, getAttributeIntegerValue, getExceptionHandler, handleException, load, load, loadDeferred, loadOrder, setExceptionHandler, store
-
Constructor Details
-
DefaultJavaBeanConfigXML
public DefaultJavaBeanConfigXML()
-
-
Method Details
-
load
Description copied from class:AbstractXmlAdapterCreate a set of configured objects from their XML description.- Specified by:
loadin interfaceXmlAdapter- Overrides:
loadin 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
Description copied from class:AbstractXmlAdapterCreate 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:
loadin interfaceXmlAdapter- Overrides:
loadin classAbstractXmlAdapter- Parameters:
e- Top-level XML element containing the descriptiono- Implementation-specific Object needed for the conversion
-
unpack
Object unpack(org.jdom2.Element e) throws ClassNotFoundException, NoSuchMethodException, InstantiationException, IntrospectionException, IllegalAccessException, InvocationTargetException -
store
Description copied from interface:XmlAdapterStore 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
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
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
-