javax.faces.event
Class MethodExpressionValueChangeListener

java.lang.Object
  extended by javax.faces.event.MethodExpressionValueChangeListener
All Implemented Interfaces:
java.util.EventListener, StateHolder, FacesListener, ValueChangeListener

public class MethodExpressionValueChangeListener
extends java.lang.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 Summary
MethodExpressionValueChangeListener()
           
MethodExpressionValueChangeListener(MethodExpression methodExpressionOneArg)
          Construct a ValueChangeListener that contains a MethodExpression.To accomodate 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.
 
Method Summary
 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, java.lang.Object state)
          

Both MethodExpression instances described in the constructor must be restored.

 java.lang.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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodExpressionValueChangeListener

public MethodExpressionValueChangeListener()

MethodExpressionValueChangeListener

public MethodExpressionValueChangeListener(MethodExpression methodExpressionOneArg)

Construct a ValueChangeListener that contains a MethodExpression.To accomodate 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).

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

MethodExpressionValueChangeListener

public MethodExpressionValueChangeListener(MethodExpression methodExpressionOneArg,
                                           MethodExpression methodExpressionZeroArg)

Construct a ValueChangeListener that contains a MethodExpression.

Method Detail

processValueChange

public 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.

Specified by:
processValueChange in interface ValueChangeListener
Parameters:
valueChangeEvent - The ValueChangeEvent that has occurred
Throws:
java.lang.NullPointerException
AbortProcessingException - Signal the JavaServer Faces implementation that no further processing on the current event should be performed

saveState

public java.lang.Object saveState(FacesContext context)

Both MethodExpression instances described in the constructor must be saved.

Specified by:
saveState in interface StateHolder

restoreState

public void restoreState(FacesContext context,
                         java.lang.Object state)

Both MethodExpression instances described in the constructor must be restored.

Specified by:
restoreState in interface StateHolder

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 interface StateHolder

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 interface StateHolder
Parameters:
newTransientValue - boolean pass true if this Object will participate in state saving or restoring, otherwise pass false.


Submit a bug or feature

Copyright © 2009, 2010, Oracle Corporation and/or its affiliates. All Rights Reserved. Use is subject to license terms.

Generated on 4-June-2010 04:34