Interface XmlAdapter

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      static ErrorHandler getDefaultExceptionHandler()
      Get the default error handler.
      ErrorHandler getExceptionHandler()
      Get the current error handler.
      void handleException​(java.lang.String description, java.lang.String operation, java.lang.String systemName, java.lang.String userName, java.lang.Exception exception)
      Provide a simple handler for errors.
      boolean load​(org.jdom2.Element e)
      Create a set of configured objects from their XML description
      void 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.
      void load​(org.jdom2.Element shared, org.jdom2.Element perNode, java.lang.Object o)
      Create a set of configured objects from their XML description, using an auxiliary object.
      boolean loadDeferred()
      Determine if this set of configured objects should be loaded after basic GUI construction is completed
      int loadOrder()  
      void setExceptionHandler​(ErrorHandler errorHandler)
      Set the error handler that will handle any errors encountered while parsing the XML.
      org.jdom2.Element store​(java.lang.Object o)
      Store the object in XML
      org.jdom2.Element store​(java.lang.Object o, boolean shared)
      Store the object in XML
    • Method Detail

      • load

        boolean load​(org.jdom2.Element e)
              throws JmriConfigureXmlException
        Create a set of configured objects from their XML description
        Parameters:
        e - Top-level XML element containing the description
        Returns:
        true if successful
        Throws:
        JmriConfigureXmlException - when a error prevents creating the objects as as required by the input XML.
      • load

        boolean load​(org.jdom2.Element shared,
                     org.jdom2.Element perNode)
              throws JmriConfigureXmlException
        Create a set of configured objects from their XML description.
        Parameters:
        shared - Top-level XML element containing the common, multi-node elements of the description
        perNode - Top-level XML element containing the private, single-node elements of the description
        Returns:
        true if successful
        Throws:
        JmriConfigureXmlException - when a error prevents creating the objects as as required by the input XML
      • loadDeferred

        boolean loadDeferred()
        Determine if this set of configured objects should be loaded after basic GUI construction is completed
        Returns:
        true to defer loading
        Since:
        2.11.2
      • load

        void load​(org.jdom2.Element e,
                  java.lang.Object o)
           throws JmriConfigureXmlException
        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.

        Parameters:
        e - Top-level XML element containing the description
        o - Implementation-specific Object needed for the conversion
        Throws:
        JmriConfigureXmlException - when a error prevents creating the objects as as required by the input XML
      • load

        void load​(org.jdom2.Element shared,
                  org.jdom2.Element perNode,
                  java.lang.Object o)
           throws JmriConfigureXmlException
        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.

        Parameters:
        shared - Top-level XML element containing the common description
        perNode - Top-level XML element containing the per-node description
        o - Implementation-specific Object needed for the conversion
        Throws:
        JmriConfigureXmlException - when a error prevents creating the objects as as required by the input XML
      • store

        org.jdom2.Element store​(java.lang.Object o)
        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
      • store

        org.jdom2.Element store​(java.lang.Object o,
                                boolean shared)
        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.
        shared - true if the returned element should be the common XML and false if the returned element should be per-node.
        Returns:
        The XML representation Element
      • handleException

        void handleException​(@Nonnull
                             java.lang.String description,
                             @CheckForNull
                             java.lang.String operation,
                             @CheckForNull
                             java.lang.String systemName,
                             @CheckForNull
                             java.lang.String userName,
                             @CheckForNull
                             java.lang.Exception exception)
                      throws JmriConfigureXmlException
        Provide a simple handler for errors. Calls the configured ErrorHandler with an ErrorMemo created using the provided parameters.
        Parameters:
        description - description of error encountered
        operation - the operation being performed, may be null
        systemName - system name of bean being handled, may be null
        userName - user name of the bean being handled, may be null
        exception - Any exception being handled in the processing, may be null
        Throws:
        JmriConfigureXmlException - in place for later expansion; should be propagated upward to higher-level error handling
      • setExceptionHandler

        void setExceptionHandler​(ErrorHandler errorHandler)
        Set the error handler that will handle any errors encountered while parsing the XML. If not specified, the default error handler will be used.
        Parameters:
        errorHandler - the error handler or null to ignore parser errors
      • getExceptionHandler

        ErrorHandler getExceptionHandler()
        Get the current error handler.
        Returns:
        the error handler or null if no error handler is assigned