QScript  2.1.2
Expression and algorithm evaluator
 All Classes Namespaces Functions Variables Pages
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
org.qscript.eventsonfire.AbstractEventHandlerInfo Class Referenceabstract

Inherits org.qscript.eventsonfire.EventHandlerInfo.

Inherited by org.qscript.eventsonfire.EventHandlerAnnotationInfo, org.qscript.eventsonfire.PooledEventHandlerAnnotationInfo, and org.qscript.eventsonfire.SwingEventHandlerAnnotationInfo.

Classes

enum  MethodType
 

Public Member Functions

 AbstractEventHandlerInfo (Method method, Class<?>[] producerTypesByAnnotation, Class<?>[] eventTypesByAnnotation, String[] anyTagsByAnnotation, String[] eachTagsByAnnotation)
 
MethodType getMethodType ()
 
Method getMethod ()
 
Class<?>[] getProducerTypes ()
 
Class<?>[] getEventTypes ()
 
Set< String > getAnyTags ()
 
Set< String > getEachTags ()
 
boolean invoke (Object producer, Object consumer, Object event, String...tags)
 

Protected Member Functions

abstract void call (Object producer, Object consumer, Object event, String...tags)
 
boolean isCallable (final Class<?> producerType, final Class<?> eventType, String...tags)
 
boolean isProducerAssignable (final Class<?> type)
 
boolean isEventAssignable (final Class<?> type)
 
boolean isTagsMatching (String[] tags)
 
boolean isAnyTagsMatching (String[] tags)
 
boolean isEachTagsMatching (String[] tags)
 

Static Protected Member Functions

static void validateAssignableProvider (Method method, Class<?> parameterType, Class<?>[] producerTypesByAnnotation)
 
static void validateAssignableEvent (Method method, Class<?> parameterType, Class<?>[] eventTypesByAnnotation)
 
static void validateTagsOfString (Method method, Class<?> parameterType)
 
static void validateEventTypeByAnnotationNotEmpty (Method method, Class<?>[] eventTypesByAnnotation)
 
static void validateReturnType (Method method)
 
static< TYPE > TYPE[] toArray (TYPE fallback, TYPE...values)
 
static< TYPE > Set< TYPE > toSet (TYPE fallback, TYPE...values)
 

Protected Attributes

final MethodType methodType
 
final Method method
 
final Class<?>[] producerTypes
 
final Class<?>[] eventTypes
 
final Set< String > anyTags
 
final Set< String > eachTags
 

Detailed Description

Abstract implementation of an EventHandlerInfo based on a method with possible and allowed producer and event types.

Author
Manfred HANTSCHEL

Member Function Documentation

abstract void org.qscript.eventsonfire.AbstractEventHandlerInfo.call ( Object  producer,
Object  consumer,
Object  event,
String...  tags 
)
protectedpure virtual

If the event handler is invokable, this method calls it

Parameters
producerthe producer
consumerthe consumer
eventthe event
tagsthe tags
Set<String> org.qscript.eventsonfire.AbstractEventHandlerInfo.getAnyTags ( )

Returns the any tags

Returns
the any tags
Set<String> org.qscript.eventsonfire.AbstractEventHandlerInfo.getEachTags ( )

Returns the each tags

Returns
the each tags
Class<?> [] org.qscript.eventsonfire.AbstractEventHandlerInfo.getEventTypes ( )

Returns all allowed event types

Returns
an array of event types
Method org.qscript.eventsonfire.AbstractEventHandlerInfo.getMethod ( )

Returns the method

Returns
the method
MethodType org.qscript.eventsonfire.AbstractEventHandlerInfo.getMethodType ( )

Returns the method type

Returns
the method type
Class<?> [] org.qscript.eventsonfire.AbstractEventHandlerInfo.getProducerTypes ( )

Returns all allowed producer types

Returns
an array of producer types
boolean org.qscript.eventsonfire.AbstractEventHandlerInfo.invoke ( Object  producer,
Object  consumer,
Object  event,
String...  tags 
)

Invokes the method referenced by this information object if applicable for the type of producer, consumer and event. If an error occurs when invoking the method, the invocationFailed method of the ErrorHandler is called.

Parameters
producerthe producer, mandatory
consumerthe consumer, mandatory
eventthe event, mandatory
tagsthe tags
Returns
true if invoked (or will be invoked in near future), false otherwise

Implements org.qscript.eventsonfire.EventHandlerInfo.

boolean org.qscript.eventsonfire.AbstractEventHandlerInfo.isCallable ( final Class<?>  producerType,
final Class<?>  eventType,
String...  tags 
)
protected

Returns true if the event handler is callable

Parameters
producerTypethe type of the producer
eventTypethe type of the event
tagssome tags
Returns
true if invokable
boolean org.qscript.eventsonfire.AbstractEventHandlerInfo.isEventAssignable ( final Class<?>  type)
protected

Returns true if the event is permitted by the annotation and the parameter

Parameters
typethe type of the event
Returns
true if permitted
boolean org.qscript.eventsonfire.AbstractEventHandlerInfo.isProducerAssignable ( final Class<?>  type)
protected

Returns true if the producer is permitted by the annotation and the parameter

Parameters
typethe type of the producer
Returns
true if permitted

The documentation for this class was generated from the following file: