Search in sources :

Example 1 with ActionAnnotationValues

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

the class ActionMethodParser method parse.

/**
 * Parses java action method annotation and returns its action runtime.
 *
 * @param actionClass action class
 * @param actionMethod action method
 * @param actionDefinition optional action def, usually <code>null</code> so to be parsed
 */
public ActionRuntime parse(final Class<?> actionClass, final Method actionMethod, ActionDefinition actionDefinition) {
    final ActionAnnotationValues annotationValues = detectActionAnnotationValues(actionMethod);
    final ActionConfig actionConfig = resolveActionConfig(annotationValues);
    // interceptors
    final ActionInterceptor[] actionInterceptors = parseActionInterceptors(actionClass, actionMethod, actionConfig);
    // filters
    final ActionFilter[] actionFilters = parseActionFilters(actionClass, actionMethod, actionConfig);
    // build action definition when not provided
    if (actionDefinition == null) {
        actionDefinition = parseActionDefinition(actionClass, actionMethod);
    }
    detectAndRegisterAlias(annotationValues, actionDefinition);
    final boolean async = parseMethodAsyncFlag(actionMethod);
    final boolean auth = parseMethodAuthFlag(actionMethod);
    final Class<? extends ActionResult> actionResult = parseActionResult(actionMethod);
    final Class<? extends ActionResult> defaultActionResult = actionConfig.getActionResult();
    return createActionRuntime(null, actionClass, actionMethod, actionResult, defaultActionResult, actionFilters, actionInterceptors, actionDefinition, async, auth);
}
Also used : ActionConfig(jodd.madvoc.ActionConfig) ActionInterceptor(jodd.madvoc.interceptor.ActionInterceptor) ActionFilter(jodd.madvoc.filter.ActionFilter) ActionAnnotationValues(jodd.madvoc.meta.ActionAnnotationValues)

Example 2 with ActionAnnotationValues

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

the class ActionMethodParser method parseActionDefinition.

/**
 * Parses action class and method and creates {@link ActionDefinition parsed action definition}.
 */
public ActionDefinition parseActionDefinition(final Class<?> actionClass, final Method actionMethod) {
    final ActionAnnotationValues annotationValues = detectActionAnnotationValues(actionMethod);
    final ActionConfig actionConfig = resolveActionConfig(annotationValues);
    final String[] packageActionNames = readPackageActionPath(actionClass);
    final String[] classActionNames = readClassActionPath(actionClass);
    final String[] methodActionNames = readMethodActionPath(actionMethod.getName(), annotationValues, actionConfig);
    final String method = readMethodHttpMethod(actionMethod);
    final ActionNames actionNames = new ActionNames(packageActionNames, classActionNames, methodActionNames, method);
    final ActionNamingStrategy namingStrategy;
    try {
        namingStrategy = ClassUtil.newInstance(actionConfig.getNamingStrategy());
        contextInjectorComponent.injectContext(namingStrategy);
    } catch (final Exception ex) {
        throw new MadvocException(ex);
    }
    return namingStrategy.buildActionDef(actionClass, actionMethod, actionNames);
}
Also used : ActionConfig(jodd.madvoc.ActionConfig) ActionNamingStrategy(jodd.madvoc.path.ActionNamingStrategy) ActionNames(jodd.madvoc.config.ActionNames) MadvocException(jodd.madvoc.MadvocException) MadvocException(jodd.madvoc.MadvocException) ActionAnnotationValues(jodd.madvoc.meta.ActionAnnotationValues)

Aggregations

ActionConfig (jodd.madvoc.ActionConfig)2 ActionAnnotationValues (jodd.madvoc.meta.ActionAnnotationValues)2 MadvocException (jodd.madvoc.MadvocException)1 ActionNames (jodd.madvoc.config.ActionNames)1 ActionFilter (jodd.madvoc.filter.ActionFilter)1 ActionInterceptor (jodd.madvoc.interceptor.ActionInterceptor)1 ActionNamingStrategy (jodd.madvoc.path.ActionNamingStrategy)1