jodd.madvoc.component
Class ActionMethodParser

java.lang.Object
  extended by jodd.madvoc.component.ActionMethodParser

public class ActionMethodParser
extends java.lang.Object

Creates action configurations from action java method. Reads all annotations and builds action path (i.e. configuration).

Invoked only during registration, therefore performance is not most important.

See Also:
ActionPathMapper

Field Summary
protected static java.lang.String MACRO_CLASS
           
protected static java.lang.String MACRO_EXTENSION
           
protected static java.lang.String MACRO_METHOD
           
protected static java.lang.String MACRO_PACKAGE
           
protected  MadvocConfig madvocConfig
           
 
Constructor Summary
ActionMethodParser()
           
 
Method Summary
protected  java.lang.String buildActionPath(java.lang.String packageActionPath, java.lang.String classActionPath, java.lang.String methodActionPath, java.lang.String extension, java.lang.String httpMethod)
          Builds action path.
protected  java.lang.String convertClassNameToActionName(java.lang.String name)
          Builds class action path from the class name.
protected  ActionConfig createActionConfig(java.lang.Class actionClass, java.lang.reflect.Method actionMethod, java.lang.Class<? extends ActionInterceptor>[] interceptorClasses, java.lang.String actionPath)
          Creates new instance of action configuration.
 ActionConfig parse(java.lang.Class<?> actionClass, java.lang.reflect.Method actionMethod)
           
 ActionConfig parse(java.lang.Class<?> actionClass, java.lang.reflect.Method actionMethod, java.lang.String actionPath)
          Parses java action method annotations and returns its action configuration.
protected  java.lang.String readClassActionPath(java.lang.Class actionClass)
          Reads action path from class.
protected  java.lang.Class<? extends ActionInterceptor>[] readClassInterceptors(java.lang.Class actionClass)
          Reads class interceptors when method interceptors are not availiable.
protected  java.lang.String readMethodActionPath(java.lang.reflect.Method actionMethod)
          Reads action method.
protected  java.lang.String readMethodAlias(java.lang.reflect.Method actionMethod)
          Reads method's alias value.
protected  java.lang.String readMethodExtension(java.lang.reflect.Method actionMethod)
          Reads method's extension.
protected  java.lang.Class<? extends ActionInterceptor>[] readMethodInterceptors(java.lang.reflect.Method actionMethod)
          Reads method interceptors.
protected  java.lang.String readPackageActionPath(java.lang.Class actionClass)
          Reads action path for package.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MACRO_PACKAGE

protected static final java.lang.String MACRO_PACKAGE
See Also:
Constant Field Values

MACRO_CLASS

protected static final java.lang.String MACRO_CLASS
See Also:
Constant Field Values

MACRO_METHOD

protected static final java.lang.String MACRO_METHOD
See Also:
Constant Field Values

MACRO_EXTENSION

protected static final java.lang.String MACRO_EXTENSION
See Also:
Constant Field Values

madvocConfig

@PetiteInject
protected MadvocConfig madvocConfig
Constructor Detail

ActionMethodParser

public ActionMethodParser()
Method Detail

parse

public ActionConfig parse(java.lang.Class<?> actionClass,
                          java.lang.reflect.Method actionMethod)

parse

public ActionConfig parse(java.lang.Class<?> actionClass,
                          java.lang.reflect.Method actionMethod,
                          java.lang.String actionPath)
Parses java action method annotations and returns its action configuration. Returns null if method is not a madvoc action.


buildActionPath

protected java.lang.String buildActionPath(java.lang.String packageActionPath,
                                           java.lang.String classActionPath,
                                           java.lang.String methodActionPath,
                                           java.lang.String extension,
                                           java.lang.String httpMethod)
Builds action path. Method action path and extension may be null.

Parameters:
packageActionPath - action path from package (optional)
classActionPath - action path from class
methodActionPath - action path from method (optional)
extension - extension (optional)
httpMethod - (optional)

readClassInterceptors

protected java.lang.Class<? extends ActionInterceptor>[] readClassInterceptors(java.lang.Class actionClass)
Reads class interceptors when method interceptors are not availiable.


readMethodInterceptors

protected java.lang.Class<? extends ActionInterceptor>[] readMethodInterceptors(java.lang.reflect.Method actionMethod)
Reads method interceptors.


readPackageActionPath

protected java.lang.String readPackageActionPath(java.lang.Class actionClass)
Reads action path for package. It can be used only if root package is set in madvoc configuration. If annotation is not set on package-level, class package will be used for package action path part.


readClassActionPath

protected java.lang.String readClassActionPath(java.lang.Class actionClass)
Reads action path from class. If the class is annotated with MadvocAction annotation, class action path will be read from annotation value. Otherwise, action class path will be built from the class name. This is done by removing the package name and the last contained word (if there is more then one) from the class name. Such name is finally uncapitalized.

If this method returns null class will be ignored.


convertClassNameToActionName

protected java.lang.String convertClassNameToActionName(java.lang.String name)
Builds class action path from the class name.


readMethodActionPath

protected java.lang.String readMethodActionPath(java.lang.reflect.Method actionMethod)
Reads action method.


readMethodExtension

protected java.lang.String readMethodExtension(java.lang.reflect.Method actionMethod)
Reads method's extension.


readMethodAlias

protected java.lang.String readMethodAlias(java.lang.reflect.Method actionMethod)
Reads method's alias value.


createActionConfig

protected ActionConfig createActionConfig(java.lang.Class actionClass,
                                          java.lang.reflect.Method actionMethod,
                                          java.lang.Class<? extends ActionInterceptor>[] interceptorClasses,
                                          java.lang.String actionPath)
Creates new instance of action configuration.



Copyright © 2003-2011 Jodd Team