Package ghidra.framework.model

# Class AbstractDomainObjectListenerBuilder<R extends DomainObjectChangeRecord,B extends AbstractDomainObjectListenerBuilder<R,B>>

java.lang.Object
ghidra.framework.model.AbstractDomainObjectListenerBuilder<R,B>

Type Parameters:
  `R` - The DomainObjectChangeRecord type
  `B` - The AbstractDomainObjectListeBuilder type (the only difference is R, the record type)

Direct Known Subclasses:
  `DomainObjectListenerBuilder`

public abstract class AbstractDomainObjectListenerBuilder<R extends DomainObjectChangeRecord,B extends AbstractDomainObjectListenerBuilder<R,B>> extends Object
Base class for creating a compact and efficient `DomainObjectListener`s. See `DomainObjectListenerBuilder` for full documentation.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `class`
  `AbstractDomainObjectListenerBuilder.AnyBuilder`
  Sub-builder for collection eventTypes before eventually being association with a callback or callback with termination
  `class`
  `AbstractDomainObjectListenerBuilder.EachBuilder`
  Sub-builder for collection eventTypes before eventually being associated with a consumer for records with those types

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractDomainObjectListenerBuilder(String name, Class<R> recordClass)`
  Creates a builder with the given recordClass as the default record class

- ## Method Summary

  Modifier and Type
  Method
  Description
  `AbstractDomainObjectListenerBuilder<R,B>.AnyBuilder`
  `any(EventType... eventTypes)`
  Allows for specifying multiple event types that if the event contains any records with and of the given types, then a callback or callback with terminate will be triggered, depending on if the next builder operation is either a call or terminate respectively.
  `DomainObjectListener`
  `build()`
  Builds and returns a new DomainObjectEventHandler
  `B`
  `debug(Consumer<DomainObjectChangedEvent> consumer)`
  Sets a consumer of events that is intended to be used for clients to add a callback for each event.
  `AbstractDomainObjectListenerBuilder<R,B>.EachBuilder`
  `each(EventType... eventTypes)`
  Allows for specifying multiple event types that for each record with one of the specified types, the follow on consumer will be called.
  `String`
  `getName()`
  Returns the name that will be associated with the domainObjectListener.
  `B`
  `ignoreWhen(BooleanSupplier supplier)`
  Sets a boolean supplier that can be checked to see if the client is in a state where they don't want events to be processed at this time.
  `protected abstract B`
  `self()`
  `<R2 extends DomainObjectChangeRecord, B2 extends AbstractDomainObjectListenerBuilder<R2, B2>>
  B2`
  `with(Class<R2> clazz)`
  Allows for specifying a new record type that any follow on consumers will use for any defined "each" handlers.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### AbstractDomainObjectListenerBuilder

    public AbstractDomainObjectListenerBuilder(String name, Class<R> recordClass)
    Creates a builder with the given recordClass as the default record class
    Parameters:
      `name` - the name of the client class that created this builder
      `recordClass` - the class of event records consumers will be using in any calls that take a consumer

- ## Method Details

  - ### getName

    public String getName()
    Returns the name that will be associated with the domainObjectListener. this is for debugging purposes so that you can tell where this listener came from (since it is no longer implemented by the client class)
    Returns:
      the name assigned to this builder (and ultimately the listener)

  - ### self

    protected abstract B self()

  - ### debug

    public B debug(Consumer<DomainObjectChangedEvent> consumer)
    Sets a consumer of events that is intended to be used for clients to add a callback for each event. This is useful for temporarily inspecting events and adding breakpoints.
    Parameters:
      `consumer` - the consumer to add
    Returns:
      this builder (for chaining)

  - ### ignoreWhen

    public B ignoreWhen(BooleanSupplier supplier)
    Sets a boolean supplier that can be checked to see if the client is in a state where they don't want events to be processed at this time.
    Parameters:
      `supplier` - the boolean supplier that if returns true, events are not processed
    Returns:
      this builder (for chaining)

  - ### any

    public AbstractDomainObjectListenerBuilder<R,B>.AnyBuilder any(EventType... eventTypes)
    Allows for specifying multiple event types that if the event contains any records with and of the given types, then a callback or callback with terminate will be triggered, depending on if the next builder operation is either a call or terminate respectively.
    Parameters:
      `eventTypes` - the list of events to trigger on
    Returns:
      A sub-builder for specifying the call or call with terminate

  - ### each

    public AbstractDomainObjectListenerBuilder<R,B>.EachBuilder each(EventType... eventTypes)
    Allows for specifying multiple event types that for each record with one of the specified types, the follow on consumer will be called.
    Parameters:
      `eventTypes` - the list of events to trigger on
    Returns:
      A sub-builder for specifying the consumer to be used for records with any of these types

  - ### with

    public <R2 extends DomainObjectChangeRecord, B2 extends AbstractDomainObjectListenerBuilder<R2, B2>> B2 with(Class<R2> clazz)
    Allows for specifying a new record type that any follow on consumers will use for any defined "each" handlers.
    Type Parameters:
      `R2` - the new record type
      `B2` - the new builder type that expects consumers of the new record type
    Parameters:
      `clazz` - the class of the new record type
    Returns:
      this builder with its consumer record type changed

  - ### build

    public DomainObjectListener build()
    Builds and returns a new DomainObjectEventHandler
    Returns:
      a new DomainObjectEventHandler from this builder