Interface ILcdXMLObjectFactory

All Known Implementing Classes:
TLcdXMLDefaultObjectFactory

public interface ILcdXMLObjectFactory
Deprecated.
Use of the com.format.xml API has been deprecated. Instead, use the com.format.xml.bind API.
An interface for object factories, used by element readers. An object factory gets called by an element reader, each time an object is to be created for an XML element that is processed.

The current element stack of the XML decoder and the attribute set of the object are passed to the factory as additional hints, enabling the possibility to adapt the object type that is created, depending on the values of one or more attributes present in the element. In general, a factory should only use the attributes to determine the exact object type to be created; initialization of the object (i.e., storing the attribute values in the object) should preferably be done by the element reader.

Although the use of object factories is not strictly required by the XML decoder, it is advised to do so: object factories separate the creation of objects from the handling of content, thereby giving a user the opportunity to create instances of custom-defined object types, without having to rewrite a reader - provided that the created objects implement the interface expected by the corresponding reader.

Object factories should normally be registered and retrieved via an ILcdXMLObjectFactoryProvider.

See Also:
  • Method Details

    • createObject

      Object createObject(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes, ILcdXMLDocumentContext aContext)
      Deprecated.
      Creates a new object instance for the element that is currently on top of the XML element stack.
      Parameters:
      aElementStack - The current element name stack, containing on top the XML name of the object to be created.
      aAttributes - The attribute set for the XML element on top of the element stack, for which an object is to be created.
      Returns:
      a new object instance for the element currently on top of the XML element stack.