Top Description Fields Constructors Methods
javax.faces.event

public Class MethodExpressionActionListener

extends Object
implements ActionListener, StateHolder
Class Inheritance
All Implemented Interfaces
javax.faces.component.StateHolder, javax.faces.event.ActionListener, javax.faces.event.FacesListener, java.util.EventListener
Imports
javax.el.ELContext, .ELException, .MethodExpression, .MethodNotFoundException, javax.faces.context.FacesContext, javax.faces.component.StateHolder, java.util.logging.Logger

MethodExpressionActionListener is an ActionListener that wraps a MethodExpression. When it receives a ActionEvent, it executes a method on an object identified by the MethodExpression.

Field Summary

Modifier and TypeField and Description
private static final Class<T>[]
private boolean
private static final Logger
private MethodExpression
private MethodExpression

Constructor Summary

AccessConstructor and Description
public
public
MethodExpressionActionListener(MethodExpression
a MethodExpression that points to a method that returns void and takes a single argument of type ActionEvent.
methodExpressionOneArg
)

Construct a ValueChangeListener that contains a MethodExpression.

public
MethodExpressionActionListener(MethodExpression methodExpressionOneArg, MethodExpression methodExpressionZeroArg)

Method Summary

Modifier and TypeMethod and Description
public boolean
isTransient()

Implements javax.faces.component.StateHolder.isTransient.

If true, the Object implementing this interface must not participate in state saving or restoring.

public void
processAction(ActionEvent
The ActionEvent that has occurred
actionEvent
)

Implements javax.faces.event.ActionListener.processAction.

Call through to the MethodExpression passed in our constructor.

public void
restoreState(FacesContext
the Faces context.
context
,
Object
the state.
state
)

Implements javax.faces.component.StateHolder.restoreState.

Both MethodExpression instances described in the constructor must be restored.

public Object
saveState(FacesContext
the Faces context.
context
)

Implements javax.faces.component.StateHolder.saveState.

Both MethodExpression instances described in the constructor must be saved.

public void
setTransient(boolean
boolean pass true if this Object will not participate in state saving or restoring, otherwise pass false.
newTransientValue
)

Implements javax.faces.component.StateHolder.setTransient.

Denotes whether or not the Object implementing this interface must or must not participate in state saving or restoring.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ACTION_LISTENER_ZEROARG_SIGback to summary
private static final Class<T>[] ACTION_LISTENER_ZEROARG_SIG
isTransientback to summary
private boolean isTransient
LOGGERback to summary
private static final Logger LOGGER
methodExpressionOneArgback to summary
private MethodExpression methodExpressionOneArg
methodExpressionZeroArgback to summary
private MethodExpression methodExpressionZeroArg

Constructor Detail

MethodExpressionActionListenerback to summary
public MethodExpressionActionListener()
MethodExpressionActionListenerback to summary
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.

Parameters
methodExpressionOneArg:MethodExpression

a MethodExpression that points to a method that returns void and takes a single argument of type ActionEvent.

MethodExpressionActionListenerback to summary
public MethodExpressionActionListener(MethodExpression methodExpressionOneArg, MethodExpression methodExpressionZeroArg)

Method Detail

isTransientback to summary
public boolean isTransient()

Implements javax.faces.component.StateHolder.isTransient.

Doc from javax.faces.component.StateHolder.isTransient.

If true, the Object implementing this interface must not participate in state saving or restoring.

Returns:boolean

true if transient, false otherwise.

Annotations
@Override
processActionback to summary
public void processAction(ActionEvent actionEvent) throws AbortProcessingException

Implements javax.faces.event.ActionListener.processAction.

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.

Parameters
actionEvent:ActionEvent

Doc from javax.faces.event.ActionListener.processAction.

The ActionEvent that has occurred

Annotations
@Override
Exceptions
AbortProcessingException:
Signal the JavaServer Faces implementation that no further processing on the current event should be performed
NullPointerException
restoreStateback to summary
public void restoreState(FacesContext context, Object state)

Implements javax.faces.component.StateHolder.restoreState.

Both MethodExpression instances described in the constructor must be restored.

Parameters
context:FacesContext

Doc from javax.faces.component.StateHolder.restoreState.

the Faces context.

state:Object

Doc from javax.faces.component.StateHolder.restoreState.

the state.

Annotations
@Override
saveStateback to summary
public Object saveState(FacesContext context)

Implements javax.faces.component.StateHolder.saveState.

Both MethodExpression instances described in the constructor must be saved.

Parameters
context:FacesContext

Doc from javax.faces.component.StateHolder.saveState.

the Faces context.

Returns:Object

Doc from javax.faces.component.StateHolder.saveState.

the saved state.

Annotations
@Override
setTransientback to summary
public void setTransient(boolean newTransientValue)

Implements javax.faces.component.StateHolder.setTransient.

Doc from javax.faces.component.StateHolder.setTransient.

Denotes whether or not the Object implementing this interface must or must not participate in state saving or restoring.

Parameters
newTransientValue:boolean

boolean pass true if this Object will not participate in state saving or restoring, otherwise pass false.

Annotations
@Override