Interface org.as2lib.env.event.distributor.EventDistributorControl

org.as2lib.core.BasicInterface
   +--org.as2lib.env.event.EventListenerSource
      +--org.as2lib.env.event.distributor.EventDistributorControl

Description

EventDistributorControl controls a distributor to distribute events to listeners in a compiler-safe manner.

You can get a distributor via the getDistributor method that can be casted to your listener type. This enables you to distribute events in a compiler-safe manner.

Method Index

getDistributor(), getType()

Inherited from EventListenerSource

addAllListeners(), addListener(), getAllListeners(), hasListener(), removeAllListeners(), removeListener()

Inherited from BasicInterface

toString()

Method Detail

getDistributor

public function getDistributor(Void)

Returns the typed distributor to distribute the event to all added listeners.

The returned distributor can be casted to the type all added listeners have. You can then invoke the event method on it to distribute it to all added listeners. This event distribution approach has the advantage of proper compile-time checking.

Note that the type of the returned distributor depends on the concrete implementation of this interface. Most implementations will probably expect the listener type to be passed-in on construction.

Return

the distributor to distribute the event

getType

public function getType(Void):Function

Returns the type of listeners this distributor expects. This is also the type of the distributor returned by the getDistributor method.

Return

the type of the distributor and listeners