public class MethodExpressionValueChangeListener extends Object implements ValueChangeListener, StateHolder
MethodExpressionValueChangeListener
is a ValueChangeListener that wraps a MethodExpression. When it receives a ValueChangeEvent, it
executes a method on an object identified by the MethodExpression.
| Constructor and Description |
|---|
MethodExpressionValueChangeListener() |
MethodExpressionValueChangeListener(MethodExpression methodExpressionOneArg)
Construct a
ValueChangeListener that contains a MethodExpression.To accommodate method expression targets
that take no arguments instead of taking a ValueChangeEvent 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. |
MethodExpressionValueChangeListener(MethodExpression methodExpressionOneArg,
MethodExpression methodExpressionZeroArg)
Construct a
ValueChangeListener that contains a MethodExpression. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isTransient()
If true, the Object implementing this interface must not
participate in state saving or restoring.
|
void |
processValueChange(ValueChangeEvent valueChangeEvent)
Call
through to the
MethodExpression passed in our
constructor. |
void |
restoreState(FacesContext context,
Object state)
Both |
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 MethodExpressionValueChangeListener()
public MethodExpressionValueChangeListener(MethodExpression methodExpressionOneArg)
Construct a ValueChangeListener that contains a MethodExpression.To accommodate method expression targets
that take no arguments instead of taking a ValueChangeEvent 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
processValueChange(javax.faces.event.ValueChangeEvent).
methodExpressionOneArg - a MethodExpression
that points to a method that returns void and takes
a single argument of type ValueChangeEvent.public MethodExpressionValueChangeListener(MethodExpression methodExpressionOneArg, MethodExpression methodExpressionZeroArg)
Construct a ValueChangeListener that contains a MethodExpression.
methodExpressionOneArg - a method expression that takes one argumentmethodExpressionZeroArg - a method expression that takes zero argumentspublic void processValueChange(ValueChangeEvent valueChangeEvent) 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 ValueChangeEvent 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.
processValueChange in interface ValueChangeListenervalueChangeEvent - The ValueChangeEvent that has occurredNullPointerException - if the argument valueChangeEvent is null.AbortProcessingException - Signal the JavaServer Faces
implementation that no further processing on the current event
should be performedpublic Object saveState(FacesContext context)
Both MethodExpression
instances described in the constructor must be saved.
saveState in interface StateHoldercontext - the Faces context.public void restoreState(FacesContext context, Object state)
Both MethodExpression
instances described in the constructor must be restored.
restoreState in interface StateHoldercontext - the Faces context.state - the state.public boolean isTransient()
StateHolderIf true, the Object implementing this interface must not participate in state saving or restoring.
isTransient in interface StateHoldertrue if transient, false otherwise.public void setTransient(boolean newTransientValue)
StateHolderDenotes whether or not the Object implementing this interface must or must not participate in state saving or restoring.
setTransient in interface StateHoldernewTransientValue - boolean pass true if this
Object will not
participate in state saving or restoring, otherwise pass
false.Copyright © 1996-2017, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.