Class InterceptorState

java.lang.Object
ortus.boxlang.runtime.events.InterceptorState

public class InterceptorState extends Object
An interceptor state is an event state that is used to hold observers that want to listent to that specific state. For example, the "preProcess" state is used to hold observers that listen to "preProcess" events. The is in charge of managing all states and event registrations in BoxLang.
  • Constructor Details

    • InterceptorState

      public InterceptorState(String name)
      Constructor
      Parameters:
      name - The state name
    • InterceptorState

      public InterceptorState(Key name)
      Constructor
      Parameters:
      name - The state name
  • Method Details

    • getName

      public Key getName()
      Get the state name
      Returns:
      The state name
    • register

      public InterceptorState register(DynamicObject observer)
      Register an observer for this state
      Parameters:
      observer - The observer
      Returns:
      The same state
    • unregister

      public InterceptorState unregister(DynamicObject observer)
      Unregister an observer for this state
      Parameters:
      observer - The observer
      Returns:
      The same state
    • exists

      public Boolean exists(DynamicObject observer)
      Check if an observer is registered for this state
      Parameters:
      observer - The observer to check
      Returns:
      True if the observer is registered, false otherwise
    • size

      public int size()
      Get the number of observers registered for this state
      Returns:
      The number of observers registered for this state
    • announce

      public void announce(IStruct data, IBoxContext context)
      Process the state by announcing it to all observers
      Parameters:
      data - The struct of data to pass to the observers
      context - The box context to execute on