Package arez.spy

Interface Spy


public interface Spy
Interface for interacting with spy system.
  • Method Details

    • addSpyEventHandler

      void addSpyEventHandler(@Nonnull SpyEventHandler handler)
      Add a spy handler to the list of handlers. The handler should not already be in the list.
      Parameters:
      handler - the spy handler.
    • removeSpyEventHandler

      void removeSpyEventHandler(@Nonnull SpyEventHandler handler)
      Remove spy handler from list of existing handlers. The handler should already be in the list.
      Parameters:
      handler - the spy handler.
    • willPropagateSpyEvents

      Return true if spy events will be propagated. This means spies are enabled and there is at least one spy event handler present.
      Returns:
      true if spy events will be propagated, false otherwise.
    • reportSpyEvent

      void reportSpyEvent(@Nonnull Object event)
      Report an event in the Arez system.
      Parameters:
      event - the event that occurred.
    • isTransactionActive

      Return true if there is a transaction active.
      Returns:
      true if there is a transaction active.
    • getTransaction

      Return the current transaction. This method should not be invoked unless isTransactionActive() returns true.
      Returns:
      the current transaction.
    • findComponent

      @Nullable ComponentInfo findComponent(@Nonnull String type, @Nonnull Object id)
      Find the component identified by the specified type and id.
      Parameters:
      type - the component type.
      id - the component id. Should be null if the component is a singleton.
      Returns:
      the component descriptor matching the specified type and id.
    • findAllComponentsByType

      Find all the components identified by the specified type. This collection returned is unmodifiable.
      Parameters:
      type - the component type.
      Returns:
      the collection of component descriptors of specified type.
    • findAllComponentTypes

      Find all the component types in the system. This is essentially all the types that have at least 1 instance. This collection returned is unmodifiable.
      Returns:
      the collection of component types.
    • findAllTopLevelObservableValues

      Find all the observables not contained by a native component. This method should not be invoked unless Arez.areRegistriesEnabled() returns true. This collection returned is unmodifiable.
      Returns:
      the collection of observables not contained by a native component.
    • findAllTopLevelObservers

      Find all the observers not contained by a native component. This method should not be invoked unless Arez.areRegistriesEnabled() returns true. This collection returned is unmodifiable.
      Returns:
      the collection of observers not contained by a native component.
    • findAllTopLevelComputableValues

      Find all the computable values not contained by a native component. This method should not be invoked unless Arez.areRegistriesEnabled() returns true. This collection returned is unmodifiable.
      Returns:
      the collection of computable values not contained by a native component.
    • findAllTopLevelTasks

      Find all the "top-level" tasks defined by the system. This does not return tasks that are used to define Observers etc. This method should not be invoked unless Arez.areRegistriesEnabled() returns true. This collection returned is unmodifiable.
      Returns:
      the collection of tasks defined by the context.
    • asComponentInfo

      @Nonnull ComponentInfo asComponentInfo(@Nonnull Component component)
      Convert the specified component into an ComponentInfo.
      Parameters:
      component - the Component.
      Returns:
      the ComponentInfo.
    • asObserverInfo

      @Nonnull ObserverInfo asObserverInfo(@Nonnull Observer observer)
      Convert the specified observer into an ObserverInfo.
      Parameters:
      observer - the Observer.
      Returns:
      the ObserverInfo.
    • asObservableValueInfo

      @Nonnull <T> ObservableValueInfo asObservableValueInfo(@Nonnull ObservableValue<T> observableValue)
      Convert the specified observableValue into an ObservableValueInfo.
      Type Parameters:
      T - The type of the value that is observableValue.
      Parameters:
      observableValue - the ObservableValue.
      Returns:
      the ObservableValueInfo wrapping observableValue.
    • asComputableValueInfo

      @Nonnull <T> ComputableValueInfo asComputableValueInfo(@Nonnull ComputableValue<T> computableValue)
      Convert the specified ComputableValue into an ComputableValueInfo.
      Type Parameters:
      T - The type of the value that is computable.
      Parameters:
      computableValue - the ComputableValue.
      Returns:
      the ComputableValueInfo wrapping the ComputableValue.
    • asTaskInfo

      @Nonnull TaskInfo asTaskInfo(@Nonnull Task task)
      Convert the specified task into an TaskInfo.
      Parameters:
      task - the Task.
      Returns:
      the TaskInfo.