Package com.topologi.diffx.event.impl
Class AttributeEventNSImpl
java.lang.Object
com.topologi.diffx.event.impl.DiffXEventBase
com.topologi.diffx.event.impl.AttributeEventNSImpl
- All Implemented Interfaces:
AttributeEvent,DiffXEvent,XMLFormattable,XMLWritable
A namespace aware implementation of the attribute event.
- Version:
- 28 March 2010
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intA suitable hashcode value.private final StringThe name of the attribute.private final StringThe namespace URI this attribute belongs to.private final StringThe value of the attribute.Fields inherited from class com.topologi.diffx.event.impl.DiffXEventBase
ESC, weight -
Constructor Summary
ConstructorsConstructorDescriptionAttributeEventNSImpl(String name, String value) Creates a new attribute event.AttributeEventNSImpl(String uri, String name, String value) Creates a new attribute event. -
Method Summary
Modifier and TypeMethodDescriptionbooleanequals(DiffXEvent e) Returnstrueif the event is an attribute event.private static booleanReturnstrueif both namespace URI arenullor equal.getName()Returns the local name of the attribute.getURI()Returns the namespace URI the attribute belongs to.getValue()Returns the value of the attribute.inthashCode()private static inttoHashCode(String uri, String name, String value) Calculates the hashcode for this event.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
-
uri
The namespace URI this attribute belongs to. -
name
The name of the attribute. -
value
The value of the attribute. -
hashCode
private final int hashCodeA suitable hashcode value.
-
-
Constructor Details
-
AttributeEventNSImpl
Creates a new attribute event.- Parameters:
name- The local name of the attribute.value- The value of the attribute.- Throws:
NullPointerException- if any of the argument isnull.
-
AttributeEventNSImpl
Creates a new attribute event.- Parameters:
uri- The uri of the attribute.name- The local name of the attribute.value- The value of the attribute.- Throws:
NullPointerException- if any of the argument isnull.
-
-
Method Details
-
getName
Returns the local name of the attribute.This method should never return
null.- Specified by:
getNamein interfaceAttributeEvent- Returns:
- The local name of the attribute.
-
getURI
Returns the namespace URI the attribute belongs to.This method should return
nullif the implementation is not namespace aware or if the attribute is not bound to any namespace.- Specified by:
getURIin interfaceAttributeEvent- Returns:
- The namespace URI the attribute belongs to or
null.
-
getValue
Returns the value of the attribute.This method should never return
null.- Specified by:
getValuein interfaceAttributeEvent- Returns:
- The value of the attribute.
-
hashCode
public int hashCode()- Specified by:
hashCodein classDiffXEventBase
-
equals
Returnstrueif the event is an attribute event.- 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
Writes 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
Appends 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.
-
equals
Returnstrueif both namespace URI arenullor equal.- Parameters:
uri1- The first namespace URI.uri2- The second namespace URI.- Returns:
trueif bothnullor equal;falseotherwise.
-
toHashCode
Calculates the hashcode for this event.- Parameters:
uri- The URI.name- The attribute name.value- The attribute value.- Returns:
- a number suitable as a hashcode.
-