com.topologi.diffx.event.impl
Class EventFactory

java.lang.Object
  extended by com.topologi.diffx.event.impl.EventFactory

public final class EventFactory
extends Object

Factory for events.

This class is designed to returned events that are optimised for the type of sequence that it is being inserted in.

Non-namespace aware objects are lighter than namespace aware ones.

Version:
27 April 2005
Author:
Christophe Lauret

Constructor Summary
EventFactory()
          Creates a new namespace aware factory for events.
EventFactory(boolean isNamespaceAware)
          Creates a factory for events.
 
Method Summary
 AttributeEvent makeAttribute(String uri, String name, String value)
          Returns the attribute event from the name and value given.
 AttributeEvent makeAttribute(String uri, String localName, String qName, String value)
          Returns the attribute event from the name and value given.
 CloseElementEvent makeCloseElement(OpenElementEvent open)
          Returns the close element event from the corresponding open element event.
 OpenElementEvent makeOpenElement(String uri, String name)
          Returns the open element event from the uri and name given.
 OpenElementEvent makeOpenElement(String uri, String localName, String qName)
          Returns the open element event from the uri and names given.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventFactory

public EventFactory()
Creates a new namespace aware factory for events.


EventFactory

public EventFactory(boolean isNamespaceAware)
Creates a factory for events.

Parameters:
isNamespaceAware - true to create new namespace aware factory; false otherwise.
Method Detail

makeOpenElement

public OpenElementEvent makeOpenElement(String uri,
                                        String name)
Returns the open element event from the uri and name given.

If the factory is namespace aware, it returns an open element implementation using the namespace URI and the name.

If the factory is NOT namespace aware, it returns an open element implementation using the specified name.

Use this implementation if the name of the element is determined prior to the call of this method.

Parameters:
uri - The namespace URI of the element (ignored if not namespace aware)
name - The name of the element.
Returns:
The open element event from the uri and name given.

makeOpenElement

public OpenElementEvent makeOpenElement(String uri,
                                        String localName,
                                        String qName)
Returns the open element event from the uri and names given.

If the factory is namespace aware, it returns an open element implementation using the namespace URI and the local name.

If the factory is NOT namespace aware, it returns an open element implementation using the qName (namespace-prefixed name).

Parameters:
uri - The namespace URI of the element (ignored if not namespace aware)
localName - The local name of the element.
qName - The qualified name of the element.
Returns:
The open element event from the uri and name given.

makeCloseElement

public CloseElementEvent makeCloseElement(OpenElementEvent open)
Returns the close element event from the corresponding open element event.

Parameters:
open - The corresponding open element event.
Returns:
The close element event from the corresponding open element event.

makeAttribute

public AttributeEvent makeAttribute(String uri,
                                    String name,
                                    String value)
Returns the attribute event from the name and value given.

If the factory is namespace aware, it returns an attribute implementation using the namespace URI and the name.

If the factory is NOT namespace aware, it returns an attribute implementation using the specified name.

Use this implementation if the name of the element is determined prior to the call of this method.

Parameters:
uri - The namespace URI of the attribute (ignored if not namespace aware)
name - The name of the attribute.
value - The value of the attribute.
Returns:
The open element event from the uri and name given.

makeAttribute

public AttributeEvent makeAttribute(String uri,
                                    String localName,
                                    String qName,
                                    String value)
Returns the attribute event from the name and value given.

If the factory is namespace aware, it returns an attribute implementation using the namespace URI and the local name.

If the factory is NOT namespace aware, it returns an attribute implementation using the qName (namespace-prefixed name).

Parameters:
uri - The namespace URI of the attribute (ignored if not namespace aware)
localName - The local name of the attribute.
qName - The qualified name of the attribute.
value - The value of the attribute.
Returns:
The open element event from the uri and name given.