public class MethodExpressionActionListener extends java.lang.Object implements ActionListener, StateHolder
MethodExpressionActionListener is an ActionListener
that wraps a
MethodExpression
. When it receives a ActionEvent
, it executes a method on an object identified by the
MethodExpression
.
TO_FLOW_DOCUMENT_ID_ATTR_NAME
Constructor and Description |
---|
MethodExpressionActionListener() |
MethodExpressionActionListener(MethodExpression methodExpressionOneArg)
Construct a
ValueChangeListener that
contains a MethodExpression . |
MethodExpressionActionListener(MethodExpression methodExpressionOneArg,
MethodExpression methodExpressionZeroArg) |
Modifier and Type | Method and Description |
---|---|
boolean |
isTransient()
If true, the Object implementing this interface must not participate in state saving or restoring.
|
void |
processAction(ActionEvent actionEvent)
Call through to the
MethodExpression passed in
our constructor. |
void |
restoreState(FacesContext context,
java.lang.Object state)
Both |
java.lang.Object |
saveState(FacesContext context)
Both |
void |
setTransient(boolean newTransientValue)
Denotes whether or not the Object implementing this interface must or
must not participate in state saving or restoring.
|
public MethodExpressionActionListener()
public MethodExpressionActionListener(MethodExpression methodExpressionOneArg)
Construct a ValueChangeListener
that
contains a MethodExpression
. To accomodate method expression targets that
take no arguments instead of taking an ActionEvent
argument, the implementation of this class must
take the argument methodExpressionOneArg
, extract its expression string, and create another
MethodExpression
whose expected param types match those of a zero argument method. The usage
requirements for both of these MethodExpression
instances are described in
processAction(jakarta.faces.event.ActionEvent)
.
methodExpressionOneArg
- a MethodExpression
that points to a method that returns void
and takes a single argument of type ActionEvent
.public MethodExpressionActionListener(MethodExpression methodExpressionOneArg, MethodExpression methodExpressionZeroArg)
public void processAction(ActionEvent actionEvent) throws AbortProcessingException
Call through to the MethodExpression
passed in
our constructor. First, try to invoke the MethodExpression
passed to the
constructor of this instance, passing the argument ActionEvent
as the argument. If a
MethodNotFoundException
is thrown, call to the zero argument MethodExpression
derived from the
MethodExpression
passed to the constructor of this instance. If that
fails for any reason, throw an AbortProcessingException
, including the cause of the failure.
processAction
in interface ActionListener
actionEvent
- The ActionEvent
that has occurredjava.lang.NullPointerException
AbortProcessingException
- Signal the Jakarta Server Faces implementation that no further processing on the
current event should be performedpublic java.lang.Object saveState(FacesContext context)
Both MethodExpression
instances described in the constructor must be saved.
saveState
in interface StateHolder
context
- the Faces context.public void restoreState(FacesContext context, java.lang.Object state)
Both MethodExpression
instances described in the constructor must be restored.
restoreState
in interface StateHolder
context
- the Faces context.state
- the state.public boolean isTransient()
StateHolder
If true, the Object implementing this interface must not participate in state saving or restoring.
isTransient
in interface StateHolder
true
if transient, false
otherwise.public void setTransient(boolean newTransientValue)
StateHolder
Denotes whether or not the Object implementing this interface must or must not participate in state saving or restoring.
setTransient
in interface StateHolder
newTransientValue
- boolean pass true
if this Object will
not participate in state saving or restoring, otherwise pass false
.