org.codehaus.waffle.action
Class AbstractMethodDefinitionFinder

java.lang.Object
  extended by org.codehaus.waffle.action.AbstractMethodDefinitionFinder
All Implemented Interfaces:
MethodDefinitionFinder
Direct Known Subclasses:
AbstractOgnlMethodDefinitionFinder

public abstract class AbstractMethodDefinitionFinder
extends java.lang.Object
implements MethodDefinitionFinder

Abstract base implementation for all method definition finders

Author:
Michael Ward, Paul Hammant, Mauro Talevi

Field Summary
protected  MessageResources messageResources
           
 
Constructor Summary
AbstractMethodDefinitionFinder(javax.servlet.ServletContext servletContext, ArgumentResolver argumentResolver, MethodNameResolver methodNameResolver, StringTransmuter stringTransmuter, ActionMonitor actionMonitor, MessageResources messageResources)
           
 
Method Summary
 MethodDefinition find(java.lang.Object controller, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Returns a method definition of a given controller
protected abstract  java.util.List<java.lang.reflect.Method> findMethods(java.lang.Class<?> type, java.lang.String methodName)
          Returns the methods matching the type and name
protected  java.lang.String formatArgument(java.lang.String value)
          Wraps value in curly brackets to fit with default handling
protected abstract  java.util.List<java.lang.Object> getArguments(java.lang.reflect.Method method, javax.servlet.http.HttpServletRequest request)
          Returns the resolved list of method arguments.
protected  boolean hasEquivalentParameterTypes(MethodDefinition methodDefinition, StringTransmuter stringTransmuter)
           
protected  java.util.List<java.lang.Object> resolveArguments(javax.servlet.http.HttpServletRequest request, java.util.Iterator<java.lang.String> arguments)
          Resolves arguments by name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messageResources

protected final MessageResources messageResources
Constructor Detail

AbstractMethodDefinitionFinder

public AbstractMethodDefinitionFinder(javax.servlet.ServletContext servletContext,
                                      ArgumentResolver argumentResolver,
                                      MethodNameResolver methodNameResolver,
                                      StringTransmuter stringTransmuter,
                                      ActionMonitor actionMonitor,
                                      MessageResources messageResources)
Method Detail

find

public MethodDefinition find(java.lang.Object controller,
                             javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
                      throws WaffleException
Description copied from interface: MethodDefinitionFinder
Returns a method definition of a given controller

Specified by:
find in interface MethodDefinitionFinder
Parameters:
controller - the controller Object
request - the HttpServletRequest
response - the HttpServletResponse
Returns:
The MethodDefinition found
Throws:
WaffleException

hasEquivalentParameterTypes

protected boolean hasEquivalentParameterTypes(MethodDefinition methodDefinition,
                                              StringTransmuter stringTransmuter)

formatArgument

protected java.lang.String formatArgument(java.lang.String value)
Wraps value in curly brackets to fit with default handling

Parameters:
value - the argument value
Returns:
A formatted argument

resolveArguments

protected java.util.List<java.lang.Object> resolveArguments(javax.servlet.http.HttpServletRequest request,
                                                            java.util.Iterator<java.lang.String> arguments)
Resolves arguments by name

Parameters:
request - the HttpServletRequest
arguments - the List of argument names
Returns:
The List of resolved argument objects
See Also:
ArgumentResolver

getArguments

protected abstract java.util.List<java.lang.Object> getArguments(java.lang.reflect.Method method,
                                                                 javax.servlet.http.HttpServletRequest request)
Returns the resolved list of method arguments.

Parameters:
method - the action method to be invoked
request - the HttpServetRequest
Returns:
the resolved list of arguments needed to satisfy the action method invocation

findMethods

protected abstract java.util.List<java.lang.reflect.Method> findMethods(java.lang.Class<?> type,
                                                                        java.lang.String methodName)
Returns the methods matching the type and name

Parameters:
type - the Class in which to look for the method
methodName - the method name
Returns:
A List of methods
Throws:
NoMatchingActionMethodException - if no methods match


Copyright © 2008. All Rights Reserved.