Class MethodExpressionActionListener
- java.lang.Object
-
- jakarta.faces.event.MethodExpressionActionListener
-
- All Implemented Interfaces:
StateHolder,ActionListener,FacesListener,EventListener
public class MethodExpressionActionListener extends Object implements ActionListener, StateHolder
MethodExpressionActionListener is an
ActionListenerthat wraps aMethodExpression. When it receives aActionEvent, it executes a method on an object identified by theMethodExpression.
-
-
Field Summary
-
Fields inherited from interface jakarta.faces.event.ActionListener
TO_FLOW_DOCUMENT_ID_ATTR_NAME
-
-
Constructor Summary
Constructors Constructor Description MethodExpressionActionListener()MethodExpressionActionListener(MethodExpression methodExpressionOneArg)Construct aValueChangeListenerthat contains aMethodExpression.MethodExpressionActionListener(MethodExpression methodExpressionOneArg, MethodExpression methodExpressionZeroArg)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisTransient()If true, the Object implementing this interface must not participate in state saving or restoring.voidprocessAction(ActionEvent actionEvent)Call through to theMethodExpressionpassed in our constructor.voidrestoreState(FacesContext context, Object state)BothMethodExpressioninstances described in the constructor must be restored.ObjectsaveState(FacesContext context)BothMethodExpressioninstances described in the constructor must be saved.voidsetTransient(boolean newTransientValue)Denotes whether or not the Object implementing this interface must or must not participate in state saving or restoring.
-
-
-
Constructor Detail
-
MethodExpressionActionListener
public MethodExpressionActionListener()
-
MethodExpressionActionListener
public MethodExpressionActionListener(MethodExpression methodExpressionOneArg)
Construct a
ValueChangeListenerthat contains aMethodExpression. To accomodate method expression targets that take no arguments instead of taking anActionEventargument, the implementation of this class must take the argumentmethodExpressionOneArg, extract its expression string, and create anotherMethodExpressionwhose expected param types match those of a zero argument method. The usage requirements for both of theseMethodExpressioninstances are described inprocessAction(jakarta.faces.event.ActionEvent).- Parameters:
methodExpressionOneArg- aMethodExpressionthat points to a method that returnsvoidand takes a single argument of typeActionEvent.
-
MethodExpressionActionListener
public MethodExpressionActionListener(MethodExpression methodExpressionOneArg, MethodExpression methodExpressionZeroArg)
-
-
Method Detail
-
processAction
public void processAction(ActionEvent actionEvent) throws AbortProcessingException
Call through to the
MethodExpressionpassed in our constructor. First, try to invoke theMethodExpressionpassed to the constructor of this instance, passing the argumentActionEventas the argument. If aMethodNotFoundExceptionis thrown, call to the zero argumentMethodExpressionderived from theMethodExpressionpassed to the constructor of this instance. If that fails for any reason, throw anAbortProcessingException, including the cause of the failure.- Specified by:
processActionin interfaceActionListener- Parameters:
actionEvent- TheActionEventthat has occurred- Throws:
NullPointerExceptionAbortProcessingException- Signal the Jakarta Faces implementation that no further processing on the current event should be performed
-
saveState
public Object saveState(FacesContext context)
Both
MethodExpressioninstances described in the constructor must be saved.- Specified by:
saveStatein interfaceStateHolder- Parameters:
context- the Faces context.- Returns:
- the saved state.
-
restoreState
public void restoreState(FacesContext context, Object state)
Both
MethodExpressioninstances described in the constructor must be restored.- Specified by:
restoreStatein interfaceStateHolder- Parameters:
context- the Faces context.state- the state.
-
isTransient
public boolean isTransient()
Description copied from interface:StateHolderIf true, the Object implementing this interface must not participate in state saving or restoring.
- Specified by:
isTransientin interfaceStateHolder- Returns:
trueif transient,falseotherwise.
-
setTransient
public void setTransient(boolean newTransientValue)
Description copied from interface:StateHolderDenotes whether or not the Object implementing this interface must or must not participate in state saving or restoring.
- Specified by:
setTransientin interfaceStateHolder- Parameters:
newTransientValue- boolean passtrueif this Object will not participate in state saving or restoring, otherwise passfalse.
-
-