Search in sources :

Example 1 with ActionAnnotationData

use of jodd.madvoc.meta.ActionAnnotationData in project jodd by oblac.

the class ActionMethodParser method parseActionDef.

/**
	 * Parses action class and method and creates {@link jodd.madvoc.ActionDef parsed action definition}.
	 */
public ActionDef parseActionDef(final Class<?> actionClass, final Method actionMethod) {
    ActionAnnotationData annotationData = detectActionAnnotationData(actionMethod);
    // collector for all action names
    final ActionNames actionNames = new ActionNames();
    readPackageActionPath(actionNames, actionClass);
    readClassActionPath(actionNames, actionClass);
    readMethodActionPath(actionNames, actionMethod.getName(), annotationData);
    readMethodExtension(actionNames, annotationData);
    readMethodHttpMethod(actionNames, annotationData);
    final Class<? extends ActionNamingStrategy> actionPathNamingStrategy = parseMethodNamingStrategy(annotationData);
    ActionNamingStrategy namingStrategy;
    try {
        namingStrategy = actionPathNamingStrategy.newInstance();
        contextInjectorComponent.injectContext(new Target(namingStrategy));
    } catch (Exception ex) {
        throw new MadvocException(ex);
    }
    return namingStrategy.buildActionDef(actionClass, actionMethod, actionNames);
}
Also used : ActionNamingStrategy(jodd.madvoc.path.ActionNamingStrategy) Target(jodd.madvoc.injector.Target) ActionNames(jodd.madvoc.ActionNames) ActionAnnotationData(jodd.madvoc.meta.ActionAnnotationData) MadvocException(jodd.madvoc.MadvocException) MadvocException(jodd.madvoc.MadvocException)

Example 2 with ActionAnnotationData

use of jodd.madvoc.meta.ActionAnnotationData in project jodd by oblac.

the class ActionMethodParser method parse.

/**
	 * Parses java action method annotation and returns its action configuration.
	 *
	 * @param actionClass action class
	 * @param actionMethod action method
	 * @param actionDef optional action def, usually <code>null</code> so to be parsed
	 */
public ActionConfig parse(final Class<?> actionClass, final Method actionMethod, ActionDef actionDef) {
    // interceptors
    ActionInterceptor[] actionInterceptors = parseActionInterceptors(actionClass, actionMethod);
    // filters
    ActionFilter[] actionFilters = parseActionFilters(actionClass, actionMethod);
    // build action definition when not provided
    if (actionDef == null) {
        actionDef = parseActionDef(actionClass, actionMethod);
    }
    ActionAnnotationData annotationData = detectActionAnnotationData(actionMethod);
    detectAndRegisterAlias(annotationData, actionDef);
    final boolean async = parseMethodAsyncFlag(annotationData);
    final Class<? extends ActionResult> actionResult = parseActionResult(annotationData);
    return createActionConfig(actionClass, actionMethod, actionResult, actionFilters, actionInterceptors, actionDef, async);
}
Also used : ActionInterceptor(jodd.madvoc.interceptor.ActionInterceptor) ActionAnnotationData(jodd.madvoc.meta.ActionAnnotationData) ActionFilter(jodd.madvoc.filter.ActionFilter)

Aggregations

ActionAnnotationData (jodd.madvoc.meta.ActionAnnotationData)2 ActionNames (jodd.madvoc.ActionNames)1 MadvocException (jodd.madvoc.MadvocException)1 ActionFilter (jodd.madvoc.filter.ActionFilter)1 Target (jodd.madvoc.injector.Target)1 ActionInterceptor (jodd.madvoc.interceptor.ActionInterceptor)1 ActionNamingStrategy (jodd.madvoc.path.ActionNamingStrategy)1