Package com.mendix.core.actionmanagement
Class ActionListener<T extends CoreAction<?>>
- java.lang.Object
-
- com.mendix.core.actionmanagement.ActionListener<T>
-
- All Implemented Interfaces:
java.lang.Cloneable
- Direct Known Subclasses:
UserActionListener
public abstract class ActionListener<T extends CoreAction<?>> extends java.lang.Object implements java.lang.Cloneable
Abstract ActionListener
T is the type of CoreAction this listener listens to. If the check method returns true, the actions defined in before, concurrent and after will be executed.
-
-
Constructor Summary
Constructors Constructor Description ActionListener(java.lang.Class<T> targetClass)
Creates ActionListener with targetClass.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addAfterEvent(java.lang.String classOrActionName)
<R> void
addAfterEvent(java.util.function.Consumer<IMendixObject> consumer)
<R> void
addAfterEvent(java.util.function.Consumer<R> consumer, java.lang.Class<?> returnType)
Deprecated.void
addBeforeEvent(java.lang.String classOrActionName)
void
addBeforeEvent(java.lang.String classOrActionName, boolean raiseExceptionOnFalse)
<R> void
addBeforeEvent(java.util.function.Consumer<IMendixObject> consumer, boolean raiseExceptionOnFalse)
<R> void
addBeforeEvent(java.util.function.Consumer<R> consumer, java.lang.Class<?> returnType)
Deprecated.<R> void
addBeforeEvent(java.util.function.Consumer<R> consumer, java.lang.Class<?> returnType, boolean raiseExceptionOnFalse)
Deprecated.void
addReplaceEvent(java.lang.String classOrActionName)
abstract boolean
check(T action)
Checks if this Listener's events must be fired
If an action of type T is executed in the Core this function is called with that action as parameter.
If this method returns true, the before/concurrent/after actions of this ActionListener will be executed too.ActionListener<T>
clone()
java.util.List<EventActionInfo>
getAfter()
java.util.List<EventActionInfo>
getBefore()
java.lang.String
getReplace()
java.lang.Class<T>
getTargetClass()
Returns the type of action this listener listens to.void
setTargetClass(java.lang.Class<T> targetClass)
Sets the type of action this listener listens to to the specified target class.
-
-
-
Constructor Detail
-
ActionListener
public ActionListener(java.lang.Class<T> targetClass)
Creates ActionListener with targetClass.- Parameters:
targetClass
- the type of action this listener listens to
-
-
Method Detail
-
getTargetClass
public final java.lang.Class<T> getTargetClass()
Returns the type of action this listener listens to.- Returns:
- the target class
-
setTargetClass
public final void setTargetClass(java.lang.Class<T> targetClass)
Sets the type of action this listener listens to to the specified target class.- Parameters:
targetClass
- the target class to set
-
addBeforeEvent
public final void addBeforeEvent(java.lang.String classOrActionName)
-
addBeforeEvent
public final <R> void addBeforeEvent(java.util.function.Consumer<IMendixObject> consumer, boolean raiseExceptionOnFalse)
-
addBeforeEvent
@Deprecated public final <R> void addBeforeEvent(java.util.function.Consumer<R> consumer, java.lang.Class<?> returnType, boolean raiseExceptionOnFalse)
Deprecated.
-
addBeforeEvent
@Deprecated public final <R> void addBeforeEvent(java.util.function.Consumer<R> consumer, java.lang.Class<?> returnType)
Deprecated.
-
addBeforeEvent
public final void addBeforeEvent(java.lang.String classOrActionName, boolean raiseExceptionOnFalse)
-
addAfterEvent
public final void addAfterEvent(java.lang.String classOrActionName)
-
addAfterEvent
public final <R> void addAfterEvent(java.util.function.Consumer<IMendixObject> consumer)
-
addAfterEvent
@Deprecated public final <R> void addAfterEvent(java.util.function.Consumer<R> consumer, java.lang.Class<?> returnType)
Deprecated.Add after event.- Parameters:
consumer
- A function to take action on context and T.
-
addReplaceEvent
public final void addReplaceEvent(java.lang.String classOrActionName)
-
getAfter
public final java.util.List<EventActionInfo> getAfter()
-
getBefore
public final java.util.List<EventActionInfo> getBefore()
-
getReplace
public final java.lang.String getReplace()
-
check
public abstract boolean check(T action)
Checks if this Listener's events must be fired
If an action of type T is executed in the Core this function is called with that action as parameter.
If this method returns true, the before/concurrent/after actions of this ActionListener will be executed too.- Returns:
- true if this Listener's events must be fired if action is executed
-
clone
public ActionListener<T> clone() throws java.lang.CloneNotSupportedException
- Overrides:
clone
in classjava.lang.Object
- Throws:
java.lang.CloneNotSupportedException
-
-