Package arez.spy
Interface Spy
public interface Spy
Interface for interacting with spy system.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addSpyEventHandler
(SpyEventHandler handler) Add a spy handler to the list of handlers.asComponentInfo
(Component component) Convert the specified component into an ComponentInfo.asComputableValueInfo
(ComputableValue<T> computableValue) Convert the specified ComputableValue into an ComputableValueInfo.asObservableValueInfo
(ObservableValue<T> observableValue) Convert the specified observableValue into an ObservableValueInfo.asObserverInfo
(Observer observer) Convert the specified observer into an ObserverInfo.asTaskInfo
(Task task) Convert the specified task into an TaskInfo.Find all the components identified by the specified type.Find all the component types in the system.Find all the computable values not contained by a native component.Find all the observables not contained by a native component.Find all the observers not contained by a native component.Find all the "top-level" tasks defined by the system.findComponent
(String type, Object id) Find the component identified by the specified type and id.Return the current transaction.boolean
Return true if there is a transaction active.void
removeSpyEventHandler
(SpyEventHandler handler) Remove spy handler from list of existing handlers.void
reportSpyEvent
(Object event) Report an event in the Arez system.boolean
Return true if spy events will be propagated.
-
Method Details
-
addSpyEventHandler
Add a spy handler to the list of handlers. The handler should not already be in the list.- Parameters:
handler
- the spy handler.
-
removeSpyEventHandler
Remove spy handler from list of existing handlers. The handler should already be in the list.- Parameters:
handler
- the spy handler.
-
willPropagateSpyEvents
boolean 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
Report an event in the Arez system.- Parameters:
event
- the event that occurred.
-
isTransactionActive
boolean 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 unlessisTransactionActive()
returns true.- Returns:
- the current transaction.
-
findComponent
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 unlessArez.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 unlessArez.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 unlessArez.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 unlessArez.areRegistriesEnabled()
returns true. This collection returned is unmodifiable.- Returns:
- the collection of tasks defined by the context.
-
asComponentInfo
Convert the specified component into an ComponentInfo.- Parameters:
component
- the Component.- Returns:
- the ComponentInfo.
-
asObserverInfo
Convert the specified observer into an ObserverInfo.- Parameters:
observer
- the Observer.- Returns:
- the ObserverInfo.
-
asObservableValueInfo
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
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
Convert the specified task into an TaskInfo.- Parameters:
task
- the Task.- Returns:
- the TaskInfo.
-