Class ProcessingInstructionEvent

java.lang.Object
com.topologi.diffx.event.impl.DiffXEventBase
com.topologi.diffx.event.impl.ProcessingInstructionEvent
All Implemented Interfaces:
DiffXEvent, XMLFormattable, XMLWritable

public final class ProcessingInstructionEvent extends DiffXEventBase implements DiffXEvent
A processing instruction event.
Version:
27 March 2010
  • Field Details

    • target

      private final String target
      The target of the processing instruction.
    • data

      private final String data
      The data of the processing instruction.
    • hashCode

      private final int hashCode
      Hashcode value for this event.
  • Constructor Details

    • ProcessingInstructionEvent

      public ProcessingInstructionEvent(String target, String data) throws NullPointerException
      Creates a new processing instruction event.
      Parameters:
      target - The target of the processing instruction.
      data - The data of the processing instruction.
      Throws:
      NullPointerException - if any of the argument is null.
  • Method Details

    • getTarget

      public String getTarget()
      Returns the target of the processing instruction.
      Returns:
      The target of the processing instruction.
    • getData

      public String getData()
      Returns the data of the processing instruction.
      Returns:
      The data of the processing instruction.
    • hashCode

      public int hashCode()
      Description copied from class: DiffXEventBase
      Specified by:
      hashCode in class DiffXEventBase
    • equals

      public boolean equals(DiffXEvent e)
      Returns true if the event is a processing instruction.
      Specified by:
      equals in interface DiffXEvent
      Specified by:
      equals in class DiffXEventBase
      Parameters:
      e - The event to compare with this event.
      Returns:
      true if this event is equal to the specified event; false otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toXML

      public void toXML(XMLWriter xml) throws IOException
      Description copied from interface: XMLWritable
      Writes the XML representation of the implementing instance using the specified XMLWriter.
      Specified by:
      toXML in interface XMLWritable
      Parameters:
      xml - The XMLWriter to use.
      Throws:
      IOException - IF an I/O exception occurs whilst writing.
    • toXML

      public StringBuffer toXML(StringBuffer xml) throws NullPointerException
      Description copied from interface: XMLFormattable
      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:
      toXML in interface XMLFormattable
      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 is null.
    • toHashCode

      private static int toHashCode(String s1, String s2)
      Calculates the hashcode for this event.
      Parameters:
      s1 - A string to calculate the value from.
      s2 - Another string to calculate the value from.
      Returns:
      a number suitable as a hashcode.