Class org.as2lib.env.event.distributor.AbstractEventDistributorControl

Description

AbstractEventDistributorControl offers default implementations of methods needed when implementing the EventDistributorControl interface or any sub-interface.

Method Index

new AbstractEventDistributorControl()
getDistributor(), getType()

Inherited from TypeSafeEventListenerSource

Inherited from BasicClass

Constructor Detail

AbstractEventDistributorControl

public function AbstractEventDistributorControl(listenerType:Function, checkListenerType:Boolean)

Constructs a new AbstractEventDistributorControl instance.

checkListenerType is by default set to true.

Parameters

listenerTypethe expected type of listeners
checkListenerTypedetermines whether to check that passed-in listeners are of the expected type

Throws

IllegalArgumentExceptionif the passed-in listenerType is null or undefined

Method Detail

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

getDistributor

public function getDistributor(Void)

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

The returned distributor can be casted to the type specified on construction. 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 type-checking.

The returned distributor throws an EventExecutionException on distribution if an event method of a listener threw an exception.

This method does always return the same distributor.

Return

the distributor to distribute the event