Class ValueEvent
java.lang.Object
com.aquima.interactions.profile.events.ValueEvent
- All Implemented Interfaces:
IEvent
,IValueEvent
Event class holding the information of an event which will modify the attribute state.
- Since:
- 5.0
- Author:
- O. Kerpershoek
-
Method Summary
Modifier and TypeMethodDescriptionstatic IEvent
addEvent
(IEntityInstance instance, IAttributeValue previousState, IPrimitiveValue attrValue) Constructs an add value event for the specified parameters.static IEvent
clearEvent
(IEntityInstance instance, IAttributeValue previousState) Constructs a clear value event for the specified parameters.This method returns the attribute state just before the event is processed.This method returns the instance the value event will be applied on.int
getType()
This method will return the type of the event.getValue()
This method returns the value of the event.void
invokeEventHook
(IEventListener listener) The invoke event hook method will be triggered for every listener that is registered to receive events.static IEvent
removeEvent
(IEntityInstance instance, IAttributeValue previousState, IPrimitiveValue attrValue) Constructs a remove value event for the specified parameters.static IEvent
setEvent
(IEntityInstance instance, IAttributeValue previousState, IValue attrValue) Constructs a set value event for the specified parameters.
-
Method Details
-
addEvent
public static IEvent addEvent(IEntityInstance instance, IAttributeValue previousState, IPrimitiveValue attrValue) Constructs an add value event for the specified parameters.- Parameters:
instance
- The instance of the attribute.previousState
- The previous value of the attribute.attrValue
- The value of the event.- Returns:
- The value event for the specified parameters.
-
removeEvent
public static IEvent removeEvent(IEntityInstance instance, IAttributeValue previousState, IPrimitiveValue attrValue) Constructs a remove value event for the specified parameters.- Parameters:
instance
- The instance of the attribute.previousState
- The previous value of the attribute.attrValue
- The value of the event.- Returns:
- The value event for the specified parameters.
-
setEvent
public static IEvent setEvent(IEntityInstance instance, IAttributeValue previousState, IValue attrValue) Constructs a set value event for the specified parameters.- Parameters:
instance
- The instance of the attribute.previousState
- The previous value of the attribute.attrValue
- The value of the event.- Returns:
- The value event for the specified parameters.
-
clearEvent
Constructs a clear value event for the specified parameters.- Parameters:
instance
- The instance of the attribute.previousState
- The previous value of the attribute.- Returns:
- The value event for the specified parameters.
-
getType
public int getType()Description copied from interface:IEvent
This method will return the type of the event. The type of the event is used to determine which event listeners should be invoked. -
getEntityInstance
Description copied from interface:IValueEvent
This method returns the instance the value event will be applied on.- Specified by:
getEntityInstance
in interfaceIValueEvent
- Returns:
- IEntityInstance, the entity instance that will be changed.
-
getAttributeValue
Description copied from interface:IValueEvent
This method returns the attribute state just before the event is processed.- Specified by:
getAttributeValue
in interfaceIValueEvent
- Returns:
- The current state of the attribute.
-
getValue
Description copied from interface:IValueEvent
This method returns the value of the event.- Specified by:
getValue
in interfaceIValueEvent
- Returns:
- The value that is to be added, set or removed from the attribute.
-
invokeEventHook
Description copied from interface:IEvent
The invoke event hook method will be triggered for every listener that is registered to receive events. The event class that implements this interface should check if the listener that is passed as argument supports this event, and invoke the correct method of the listener to notify the listener.
For example: A context switch event can check if the listener contains a method 'onContextSwitch' and invoke that method when found.- Specified by:
invokeEventHook
in interfaceIEvent
- Parameters:
listener
- IEventListener that should be notified of the event.
-