Class DomainObjectChangedEvent

java.lang.Object
java.util.EventObject
ghidra.framework.model.DomainObjectChangedEvent
All Implemented Interfaces:
Serializable, Iterable<DomainObjectChangeRecord>

public class DomainObjectChangedEvent extends EventObject implements Iterable<DomainObjectChangeRecord>
An event indicating a DomainObject has changed. This event is actually a list of DomainObjectChangeRecords. NOTE: This object is TRANSIENT - it is only valid during the life of calls to all the DomainObjectChangeListeners. Listeners who need to retain any of this event information past the listener call should save the DomainObjectChangeRecords, which will remain valid always.
See Also:
  • Constructor Details

    • DomainObjectChangedEvent

      public DomainObjectChangedEvent(DomainObject src, List<DomainObjectChangeRecord> subEvents)
      Constructor
      Parameters:
      src - the object which has changed
      subEvents - a List of DomainObjectChangeRecords;
  • Method Details

    • numRecords

      public int numRecords()
      Return the number of change records contained within this event.
      Returns:
      the number of change records contained within this event
    • contains

      public boolean contains(EventType eventType)
      Returns true if this event contains a record with the given event type
      Parameters:
      eventType - the event type to check
      Returns:
      the number of change records contained within this event.
    • contains

      public boolean contains(EventType... types)
      Returns true if this event contains a record with any of the given event types.
      Parameters:
      types - the event types to check for
      Returns:
      true if this event contains a record with any of the given event types
    • containsEvent

      @Deprecated public boolean containsEvent(EventType eventType)
      Deprecated.
      use contains(EventType) instead. This is here to help transition older code from using integer constants for even types to the new enum way that uses enums instead.
      Returns true if this event contains a record with the given event type.
      Parameters:
      eventType - the event type to check
      Returns:
      the number of change records contained within this event.
    • getChangeRecord

      public DomainObjectChangeRecord getChangeRecord(int i)
      Get the specified change record within this event.
      Parameters:
      i - change record number
      Returns:
      change record
    • iterator

      public Iterator<DomainObjectChangeRecord> iterator()
      Returns iterator over all sub-events
      Specified by:
      iterator in interface Iterable<DomainObjectChangeRecord>
    • forEach

      public void forEach(EventType type, Consumer<DomainObjectChangeRecord> consumer)
      Loops over all records in this event and calls the consumer for each record that matches the given type.
      Parameters:
      type - the event type to apply the consumer
      consumer - the consumer to call for each record of the given type
    • findFirst

      public DomainObjectChangeRecord findFirst(EventType eventType)
      Finds the first record with the given event type.
      Parameters:
      eventType - the event type to search for
      Returns:
      the first record with the given event type