Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * This file is part of the DiffX library.
   *
   * For licensing information please see the file license.txt included in the release.
   * A copy of this licence can also be found at
   *   http://www.opensource.org/licenses/artistic-license-2.0.php
   */
  package com.topologi.diffx.event.impl;
  
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.

Author(s):
Christophe Lauret
Version:
27 April 2005
 
 public final class EventFactory {
 
   // class attributes ---------------------------------------------------------------------
 
  
Indicates whether the factory should generate namespace events.
 
   private boolean isNamespaceAware = true;
 
   // constructors -------------------------------------------------------------------------
 
  
Creates a new namespace aware factory for events.
 
   public EventFactory() {
     this. = true;
   }

  
Creates a factory for events.

Parameters:
isNamespaceAware true to create new namespace aware factory; false otherwise.
 
   public EventFactory(boolean isNamespaceAware) {
     this. = isNamespaceAware;
   }
 
   // methods ------------------------------------------------------------------------------
 
  
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.
 
   public OpenElementEvent makeOpenElement(String uriString name) {
     if (this.return new OpenElementEventNSImpl(uriname);
     else
       return new OpenElementEventImpl(name);
   }

  
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.
 
   public OpenElementEvent makeOpenElement(String uriString localNameString qName) {
     if (this.return new OpenElementEventNSImpl(urilocalName);
     else
       return new OpenElementEventImpl(qName);
   }

  
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.
    if (this.return new CloseElementEventNSImpl(open);
    else
      return new CloseElementEventImpl(open);
  }

  
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.
  public AttributeEvent makeAttribute(String uriString nameString value) {
    if (this.return new AttributeEventNSImpl("".equals(uri)? null : urinamevalue);
    else
      return new AttributeEventImpl(namevalue);
  }

  
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.
  public AttributeEvent makeAttribute(String uriString localNameString qNameString value) {
    if (this.return new AttributeEventNSImpl("".equals(uri)? null : urilocalNamevalue);
    else
      return new AttributeEventImpl(qNamevalue);
  }
New to GrepCode? Check out our FAQ X