Package com.topologi.diffx.event.impl
Class AttributeEventImpl
java.lang.Object
com.topologi.diffx.event.impl.DiffXEventBase
com.topologi.diffx.event.impl.AttributeEventImpl
- All Implemented Interfaces:
AttributeEvent,DiffXEvent,XMLFormattable,XMLWritable
A basic implementation of the attribute event.
This implementation is not namespace aware.
- Version:
- 28 March 2010
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intA suitable hashcode value.private final StringThe name of the attribute.private final StringThe value of the attribute.Fields inherited from class com.topologi.diffx.event.impl.DiffXEventBase
ESC, weight -
Constructor Summary
ConstructorsConstructorDescriptionAttributeEventImpl(String name, String value) Creates a new attribute event. -
Method Summary
Modifier and TypeMethodDescriptionbooleanequals(DiffXEvent e) Returnstrueif the event is an attribute event.getName()Returns the local name of the attribute.getURI()Always returnnull.getValue()Returns the value of the attribute.inthashCode()private static inttoHashCode(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
-
name
The name of the attribute. -
value
The value of the attribute. -
hashCode
private final int hashCodeA suitable hashcode value.
-
-
Constructor Details
-
AttributeEventImpl
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.
-
-
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
Always returnnull. 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.
-
toHashCode
Calculates the hashcode for this event.- Parameters:
name- The attribute name.value- The attribute value.- Returns:
- a number suitable as a hashcode.
-