- java.lang.Object
-
- javax.faces.event.MethodExpressionValueChangeListener
-
- All Implemented Interfaces:
- EventListener, StateHolder, FacesListener, ValueChangeListener
public class MethodExpressionValueChangeListener extends Object implements ValueChangeListener, StateHolder
MethodExpressionValueChangeListener is a
ValueChangeListener
that wraps aMethodExpression
. When it receives aValueChangeEvent
, it executes a method on an object identified by theMethodExpression
.
-
-
Constructor Summary
Constructors Constructor and Description MethodExpressionValueChangeListener()
MethodExpressionValueChangeListener(MethodExpression methodExpressionOneArg)
Construct aValueChangeListener
that contains aMethodExpression
.To accomodate method expression targets that take no arguments instead of taking aValueChangeEvent
argument, the implementation of this class must take the argumentmethodExpressionOneArg
, extract its expression string, and create anotherMethodExpression
whose expected param types match those of a zero argument method.MethodExpressionValueChangeListener(MethodExpression methodExpressionOneArg, MethodExpression methodExpressionZeroArg)
Construct aValueChangeListener
that contains aMethodExpression
.
-
Method Summary
All Methods Instance Methods Concrete Methods 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 theMethodExpression
passed in our constructor.void
restoreState(FacesContext context, Object state)
Both
MethodExpression
instances described in the constructor must be restored.Object
saveState(FacesContext context)
Both
MethodExpression
instances described in the constructor must be saved.void
setTransient(boolean newTransientValue)
Denotes whether or not the Object implementing this interface must or must not participate in state saving or restoring.
-
-
-
Constructor Detail
-
MethodExpressionValueChangeListener
public MethodExpressionValueChangeListener()
-
MethodExpressionValueChangeListener
public MethodExpressionValueChangeListener(MethodExpression methodExpressionOneArg)
Construct a
ValueChangeListener
that contains aMethodExpression
.To accomodate method expression targets that take no arguments instead of taking aValueChangeEvent
argument, the implementation of this class must take the argumentmethodExpressionOneArg
, extract its expression string, and create anotherMethodExpression
whose expected param types match those of a zero argument method. The usage requirements for both of theseMethodExpression
instances are described inprocessValueChange(javax.faces.event.ValueChangeEvent)
.- Parameters:
methodExpressionOneArg
- aMethodExpression
that points to a method that returnsvoid
and takes a single argument of typeValueChangeEvent
.
-
MethodExpressionValueChangeListener
public MethodExpressionValueChangeListener(MethodExpression methodExpressionOneArg, MethodExpression methodExpressionZeroArg)
Construct a
ValueChangeListener
that contains aMethodExpression
.
-
-
Method Detail
-
processValueChange
public void processValueChange(ValueChangeEvent valueChangeEvent) throws AbortProcessingException
Call through to the
MethodExpression
passed in our constructor. First, try to invoke theMethodExpression
passed to the constructor of this instance, passing the argumentValueChangeEvent
as the argument. If aMethodNotFoundException
is thrown, call to the zero argumentMethodExpression
derived from theMethodExpression
passed to the constructor of this instance.If that fails for any reason, throw anAbortProcessingException
, including the cause of the failure.- Specified by:
processValueChange
in interfaceValueChangeListener
- Parameters:
valueChangeEvent
- TheValueChangeEvent
that has occurred- Throws:
NullPointerException
- if the argument valueChangeEvent is null.AbortProcessingException
- Signal the JavaServer Faces implementation that no further processing on the current event should be performed
-
saveState
public Object saveState(FacesContext context)
Both
MethodExpression
instances described in the constructor must be saved.- Specified by:
saveState
in interfaceStateHolder
-
restoreState
public void restoreState(FacesContext context, Object state)
Both
MethodExpression
instances described in the constructor must be restored.- Specified by:
restoreState
in interfaceStateHolder
-
isTransient
public boolean isTransient()
Description copied from interface:StateHolder
If true, the Object implementing this interface must not participate in state saving or restoring.
- Specified by:
isTransient
in interfaceStateHolder
-
setTransient
public void setTransient(boolean newTransientValue)
Description copied from interface:StateHolder
Denotes whether or not the Object implementing this interface must or must not participate in state saving or restoring.
- Specified by:
setTransient
in interfaceStateHolder
- Parameters:
newTransientValue
- boolean passtrue
if this Object will not participate in state saving or restoring, otherwise passfalse
.
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
21/08/2025 18:35:35 Cette version de la page est en cache (à la date du 21/08/2025 18:35:35) afin d'accélérer le traitement.Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la version plus récente de la page.
Document créé le 14/04/2008, dernière modification le 18/08/2025
Source du document imprimé : https://www.gaudry.be/java-api-javaee-rf-javax/faces/event/MethodExpressionValueChangeListener.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.