Package com.topologi.diffx.event.impl
Class CloseElementEventImpl
java.lang.Object
com.topologi.diffx.event.impl.DiffXEventBase
com.topologi.diffx.event.impl.CloseElementEventImpl
- All Implemented Interfaces:
CloseElementEvent,DiffXEvent,XMLFormattable,XMLWritable
A basic implementation of the close element event.
It corresponds to the endElement SAX event.
This implementation is not namespace aware.
- Version:
- 17 May 2005
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final OpenElementEventThe corresponding open element event.Fields inherited from class com.topologi.diffx.event.impl.DiffXEventBase
ESC, weight -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new close element event that corresponds to the given open element.CloseElementEventImpl(String name) Creates a new close element event. -
Method Summary
Modifier and TypeMethodDescriptionbooleanequals(DiffXEvent e) Returnstrueif the event is a close element and has the same name.getName()Returns the local name of the element.Returns the corresponding event element.getURI()Always return the empty URI.inthashCode()booleanmatch(OpenElementEvent event) Returnstrueif the open element has the same name.toString()voidWrites the XML representation of the implementing instance using the specifiedXMLWriter.toXML(StringBuffer xml) Appends the XML representation of the object of the implementing class.Methods inherited from class com.topologi.diffx.event.impl.DiffXEventBase
equals, getWeight, setWeight, toXMLMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.topologi.diffx.event.DiffXEvent
getWeight, setWeightMethods inherited from interface com.topologi.diffx.xml.XMLFormattable
toXML
-
Field Details
-
open
The corresponding open element event.
-
-
Constructor Details
-
CloseElementEventImpl
Creates a new close element event.- Parameters:
name- The local name of the element- Throws:
NullPointerException- If the name isnull.
-
CloseElementEventImpl
Creates a new close element event that corresponds to the given open element.- Parameters:
event- The corresponding open element.- Throws:
NullPointerException- If the name isnull.
-
-
Method Details
-
getName
Description copied from interface:CloseElementEventReturns the local name of the element.- Specified by:
getNamein interfaceCloseElementEvent- Returns:
- Returns the name.
-
getURI
Always return the empty URI.- Specified by:
getURIin interfaceCloseElementEvent- Returns:
- Returns the uri.
- See Also:
-
getOpenElement
Description copied from interface:CloseElementEventReturns the corresponding event element.- Specified by:
getOpenElementin interfaceCloseElementEvent- Returns:
- The corresponding event element.
-
match
Returnstrueif the open element has the same name. Indicates whether the specified open element event matches this close element event.This method first checks whether the open element event is the same as event returned by the
CloseElementEvent.getOpenElement()method, if not it simply compares the name of the element and the namespace URI it belongs to.- Specified by:
matchin interfaceCloseElementEvent- Parameters:
event- The open element event to test.- Returns:
trueif there is a match;falseotherwise.
-
hashCode
public int hashCode()Description copied from class:DiffXEventBase- Specified by:
hashCodein classDiffXEventBase
-
equals
Returnstrueif the event is a close element and has the same name.- Specified by:
equalsin interfaceDiffXEvent- Specified by:
equalsin classDiffXEventBase- Parameters:
e- The event to compare with this event.- Returns:
trueif this event is equal to the specified event;falseotherwise.
-
toString
-
toXML
Description copied from interface:XMLWritableWrites the XML representation of the implementing instance using the specifiedXMLWriter.- Specified by:
toXMLin interfaceXMLWritable- Parameters:
xml- The XMLWriter to use.- Throws:
IOException- IF an I/O exception occurs whilst writing.
-
toXML
Description copied from interface:XMLFormattableAppends the XML representation of the object of the implementing class.Implementations must ensure that the returned string buffer is the same object as the specified string buffer.
- Specified by:
toXMLin interfaceXMLFormattable- Parameters:
xml- The string buffer to which the XML representation is appended to.- Returns:
- The modified string buffer.
- Throws:
NullPointerException- if the specified character sequence isnull.
-