Search in sources :

Example 6 with Out

use of jodd.madvoc.meta.Out 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;
}
Also used : Target(jodd.madvoc.injector.Target) Out(jodd.madvoc.meta.Out)

Aggregations

Out (jodd.madvoc.meta.Out)6 ScopeData (jodd.madvoc.ScopeData)5 InOut (jodd.madvoc.meta.InOut)4 In (jodd.madvoc.meta.In)3 ScopeType (jodd.madvoc.ScopeType)2 Annotation (java.lang.annotation.Annotation)1 ArrayList (java.util.ArrayList)1 ClassDescriptor (jodd.introspector.ClassDescriptor)1 PropertyDescriptor (jodd.introspector.PropertyDescriptor)1 MadvocException (jodd.madvoc.MadvocException)1 ScopeDataResolver (jodd.madvoc.component.ScopeDataResolver)1 Target (jodd.madvoc.injector.Target)1 Test (org.junit.Test)1