Search in sources :

Example 1 with ActionNamingStrategy

use of jodd.madvoc.path.ActionNamingStrategy 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 ActionNamingStrategy

use of jodd.madvoc.path.ActionNamingStrategy 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

MadvocException (jodd.madvoc.MadvocException)2 ActionNamingStrategy (jodd.madvoc.path.ActionNamingStrategy)2 ActionConfig (jodd.madvoc.ActionConfig)1 ActionNames (jodd.madvoc.ActionNames)1 ActionNames (jodd.madvoc.config.ActionNames)1 Target (jodd.madvoc.injector.Target)1 ActionAnnotationData (jodd.madvoc.meta.ActionAnnotationData)1 ActionAnnotationValues (jodd.madvoc.meta.ActionAnnotationValues)1