com.sun.rave.web.ui.component.util.event
Class Handler

java.lang.Object
  extended by com.sun.rave.web.ui.component.util.event.Handler
All Implemented Interfaces:
java.io.Serializable

public class Handler
extends java.lang.Object
implements java.io.Serializable

This class contains the information necessary to invoke a Handler. The HandlerDefinition class provides a definition of how to invoke a Handler, this class uses that information with in conjuction with information provided in this class to execute the handler method. This class typically will hold input values and specify where output should be stored.

The handler method to be invoked must have the following method signature:

public void beginDisplay(HandlerContext handlerCtx)

void above can return a value. Depending on the type of event, return values may be handled differently.

See Also:
Serialized Form

Constructor Summary
Handler(HandlerDefinition handlerDef)
          Constructor
 
Method Summary
 HandlerDefinition getHandlerDefinition()
           
protected  java.util.Map getInputMap()
           This method returns a Map of NVPs representing the input to this handler.
 java.lang.Object getInputValue(HandlerContext ctx, java.lang.String name)
           This method returns the value for the named input.
 java.lang.Object getInputValue(java.lang.String name)
           This method simply returns the named input value, null if not found.
 OutputMapping getOutput(java.lang.String name)
           
 java.lang.Object getOutputValue(HandlerContext context, java.lang.String name)
           This method retrieves an output value.
 java.lang.Object invoke(HandlerContext handlerContext)
           
 boolean isStatic()
           This method determines if the handler is static.
protected  void setHandlerDefinition(HandlerDefinition handler)
           This method sets the HandlerDefinition used by this Handler.
 void setInputValue(java.lang.String name, java.lang.Object value)
           
 void setOutputMapping(java.lang.String outputName, java.lang.String targetKey, java.lang.String targetType)
           This method adds a new OutputMapping to this handler.
 void setOutputValue(HandlerContext context, java.lang.String name, java.lang.Object value)
           This method stores an output value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Handler

public Handler(HandlerDefinition handlerDef)
Constructor

Method Detail

getHandlerDefinition

public HandlerDefinition getHandlerDefinition()

setHandlerDefinition

protected void setHandlerDefinition(HandlerDefinition handler)

This method sets the HandlerDefinition used by this Handler.


setInputValue

public void setInputValue(java.lang.String name,
                          java.lang.Object value)

getInputMap

protected java.util.Map getInputMap()

This method returns a Map of NVPs representing the input to this handler.


getInputValue

public java.lang.Object getInputValue(java.lang.String name)

This method simply returns the named input value, null if not found. It will not attempt to resolve $...{...} expressions or do modifications of any kind. If you are looking for a method to do these types of operations, try:

getInputValue(FacesContext, String).

Parameters:
name - The name used to identify the input value.

getInputValue

public java.lang.Object getInputValue(HandlerContext ctx,
                                      java.lang.String name)

This method returns the value for the named input. Input values are not stored in this HandlerContext itself, but in the Handler. If you are trying to set input values for a handler, you must create a new Handler object and set its input values.

This method attempts to resolve $...{...} expressions. It also will return the default value if the value is null. If you don't want these things to happen, look at Handler.getInputValue(String).

Parameters:
name - The input name
Returns:
The value of the input (null if not found)

getOutputValue

public java.lang.Object getOutputValue(HandlerContext context,
                                       java.lang.String name)

This method retrieves an output value. Output values are stored in the location specified by the OutputType in the Handler.

Parameters:
context - The HandlerContext
name - The output name
Returns:
The value of the output (null if not set)

setOutputValue

public void setOutputValue(HandlerContext context,
                           java.lang.String name,
                           java.lang.Object value)

This method stores an output value. Output values are stored as specified by the OutputType in the Handler.

Parameters:
context - The HandlerContext
name - The name the Handler uses for the output
value - The value to set

setOutputMapping

public void setOutputMapping(java.lang.String outputName,
                             java.lang.String targetKey,
                             java.lang.String targetType)

This method adds a new OutputMapping to this handler. An OutputMapping allows the handler to return a value and have it "mapped" to the location of your choice. The "outputType" corresponds to a registered OutputType (see OutputTypeManager).

Parameters:
outputName - The Handler's name for the output value
targetKey - The 'key' the OutputType uses to store the output
targetType - The OutputType implementation map the output

getOutput

public OutputMapping getOutput(java.lang.String name)

isStatic

public boolean isStatic()

This method determines if the handler is static.


invoke

public java.lang.Object invoke(HandlerContext handlerContext)
                        throws java.lang.InstantiationException,
                               java.lang.IllegalAccessException,
                               java.lang.reflect.InvocationTargetException
Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException