Top Description Fields Constructors Methods
jakarta.faces.event

public Class MethodExpressionValueChangeListener

extends Object
implements ValueChangeListener, StateHolder
Class Inheritance
All Implemented Interfaces
jakarta.faces.component.StateHolder, jakarta.faces.event.ValueChangeListener, jakarta.faces.event.FacesListener, java.util.EventListener
Imports
jakarta.el.ELContext, .MethodExpression, .MethodNotFoundException, jakarta.faces.component.StateHolder, jakarta.faces.context.FacesContext

MethodExpressionValueChangeListener is a ValueChangeListener that wraps a MethodExpression. When it receives a ValueChangeEvent, it executes a method on an object identified by the MethodExpression.

Field Summary

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

Constructor Summary

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

Construct a ValueChangeListener that contains a MethodExpression.

public
MethodExpressionValueChangeListener(MethodExpression
a method expression that takes one argument
methodExpressionOneArg
,
MethodExpression
a method expression that takes zero arguments
methodExpressionZeroArg
)

Construct a ValueChangeListener that contains a MethodExpression.

Method Summary

Modifier and TypeMethod and Description
public boolean
isTransient()

Implements jakarta.faces.component.StateHolder.isTransient.

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

public void
processValueChange(ValueChangeEvent
The ValueChangeEvent that has occurred
valueChangeEvent
)

Implements jakarta.faces.event.ValueChangeListener.processValueChange.

Call through to the MethodExpression passed in our constructor.

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

Implements jakarta.faces.component.StateHolder.restoreState.

Both MethodExpression instances described in the constructor must be restored.

public Object
saveState(FacesContext
the Faces context.
context
)

Implements jakarta.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 jakarta.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

isTransientback to summary
private boolean isTransient
methodExpressionOneArgback to summary
private MethodExpression methodExpressionOneArg
methodExpressionZeroArgback to summary
private MethodExpression methodExpressionZeroArg
VALUECHANGE_LISTENER_ZEROARG_SIGback to summary
private static final Class<?>[] VALUECHANGE_LISTENER_ZEROARG_SIG

Constructor Detail

MethodExpressionValueChangeListenerback to summary
public MethodExpressionValueChangeListener()
MethodExpressionValueChangeListenerback to summary
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.

Parameters
methodExpressionOneArg:MethodExpression

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

MethodExpressionValueChangeListenerback to summary
public MethodExpressionValueChangeListener(MethodExpression methodExpressionOneArg, MethodExpression methodExpressionZeroArg)

Construct a ValueChangeListener that contains a MethodExpression.

Parameters
methodExpressionOneArg:MethodExpression

a method expression that takes one argument

methodExpressionZeroArg:MethodExpression

a method expression that takes zero arguments

Method Detail

isTransientback to summary
public boolean isTransient()

Implements jakarta.faces.component.StateHolder.isTransient.

Doc from jakarta.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
processValueChangeback to summary
public void processValueChange(ValueChangeEvent valueChangeEvent) throws AbortProcessingException

Implements jakarta.faces.event.ValueChangeListener.processValueChange.

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.

Parameters
valueChangeEvent:ValueChangeEvent

Doc from jakarta.faces.event.ValueChangeListener.processValueChange.

The ValueChangeEvent that has occurred

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

Implements jakarta.faces.component.StateHolder.restoreState.

Both MethodExpression instances described in the constructor must be restored.

Parameters
context:FacesContext

Doc from jakarta.faces.component.StateHolder.restoreState.

the Faces context.

state:Object

Doc from jakarta.faces.component.StateHolder.restoreState.

the state.

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

Implements jakarta.faces.component.StateHolder.saveState.

Both MethodExpression instances described in the constructor must be saved.

Parameters
context:FacesContext

Doc from jakarta.faces.component.StateHolder.saveState.

the Faces context.

Returns:Object

Doc from jakarta.faces.component.StateHolder.saveState.

the saved state.

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

Implements jakarta.faces.component.StateHolder.setTransient.

Doc from jakarta.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