use of jodd.madvoc.injector.Target in project jodd by oblac.
the class ResultsManager method initializeResult.
// ---------------------------------------------------------------- init
/**
* Initializes action result.
*/
protected void initializeResult(ActionResult result) {
contextInjectorComponent.injectContext(new Target(result));
result.init();
}
use of jodd.madvoc.injector.Target 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);
}
use of jodd.madvoc.injector.Target in project jodd by oblac.
the class WrapperManager method initializeWrapper.
// ---------------------------------------------------------------- init
/**
* Initializes action wrapper.
*/
protected void initializeWrapper(T wrapper) {
contextInjectorComponent.injectContext(new Target(wrapper));
wrapper.init();
}
use of jodd.madvoc.injector.Target in project jodd by oblac.
the class ActionRequest method makeTargets.
/**
* Joins action and parameters into one array of Targets.
*/
protected Target[] makeTargets() {
if (!actionConfig.hasArguments) {
return new Target[] { new Target(action) };
}
ActionConfig.MethodParam[] methodParams = actionConfig.getMethodParams();
Target[] target = new Target[methodParams.length + 1];
target[0] = new Target(action);
for (int i = 0; i < methodParams.length; i++) {
ActionConfig.MethodParam mp = methodParams[i];
Class type = mp.getType();
Target t;
if (mp.getAnnotationType() == null) {
// parameter is NOT annotated
t = new Target(createActionMethodArgument(type));
} else if (mp.getAnnotationType() == Out.class) {
// parameter is annotated with *only* OUT annotation
// we need to create the output AND to save the type
t = new Target(createActionMethodArgument(type), type);
} else {
// parameter is annotated with any IN annotation
t = new Target(type) {
@Override
protected void createValueInstance() {
value = createActionMethodArgument(type);
}
};
}
target[i + 1] = t;
}
return target;
}
Aggregations