All Implemented Interfaces:
ModelIO, ModelTags, IO, ContentHandler

public class ModelHandler extends AbstractXMLHandler implements ModelTags, ModelIO

ModelHandler class.

Author:
Rainer Maximini
  • Field Details

  • Constructor Details

    • ModelHandler

      protected ModelHandler()

      Constructor for ModelHandler.

    • ModelHandler

      public ModelHandler(Model model)

      Constructor for ModelHandler.

      Parameters:
      model - a Model object
  • Method Details

    • isHandlerFor

      public boolean isHandlerFor(String uri, String localName, String qName, Attributes attributes)
      Queries the handler for possible handling of the given (SAX-)parameters
      Specified by:
      isHandlerFor in class AbstractXMLHandler
      Returns:
    • characters

      public void characters(char[] ch, int start, int length)

      Appends the given characters, at the given position, to the internal StringBuffer

      Specified by:
      characters in interface ContentHandler
      Overrides:
      characters in class AbstractXMLHandler
    • startElement

      public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
      Specified by:
      startElement in interface ContentHandler
      Throws:
      SAXException
    • endElement

      public void endElement(String uri, String localName, String qName) throws SAXException
      Specified by:
      endElement in interface ContentHandler
      Throws:
      SAXException
    • getName

      public String getName()
      Each io component must have a name that is used in IOFactory.newIO(String). The name must be unique thus it is usefull to use a short description or to the class name ( this.getClass().getName()).
      Specified by:
      getName in interface IO
      Returns:
      Returns the name of the io component.
    • getObject

      public Object getObject()
      After parsing the document, this method must be called to get the Object. This method can only be called once, because after calling the internal variables are resetted to reuse the object.
      Specified by:
      getObject in class AbstractXMLHandler
    • isFinishElements

      public boolean isFinishElements()

      isFinishElements.

      Returns:
      a boolean
    • setFinishElements

      public void setFinishElements(boolean finishElements)

      Setter for the field finishElements.

      Parameters:
      finishElements - a boolean
    • isHandlerFor

      public boolean isHandlerFor(Class value)
      Checks if the io component is capable to perform the operation for objects of this class.

      A typical implementation looks like:

       public boolean isHandlerFor(Class value) {
              if (DataObject.class.isAssignableFrom(value))
                      return true;
              return false;
       }
       
      Specified by:
      isHandlerFor in interface IO
      Parameters:
      value - The class that has to be checked.
      Returns:
      Results true if the class can oeprate with the given class.
    • copy

      public IO copy()
      overwritten copy-method from Object; use it to copy a complete operator
      Specified by:
      copy in interface IO
      Returns:
    • subHandlerFinishedWithObject

      public void subHandlerFinishedWithObject(Object subHandlerObject)
      Specified by:
      subHandlerFinishedWithObject in class AbstractXMLHandler