Search in sources :

Example 1 with Required

use of act.cli.Required in project actframework by actframework.

the class CliContextParamLoader method findContextSpecificLoader.

@Override
protected ParamValueLoader findContextSpecificLoader(String bindName, BeanSpec spec) {
    boolean isArray = spec.isArray();
    // = isArray ? resolverManager.resolver(rawType.getComponentType(), spec) : resolverManager.resolver(rawType, spec);
    StringValueResolver resolver = findResolver(spec, isArray);
    Required required = spec.getAnnotation(Required.class);
    Optional optional = null == required ? spec.getAnnotation(Optional.class) : null;
    if (null != required) {
        return new OptionLoader(bindName, required, resolver, spec);
    } else if (null != optional) {
        return new OptionLoader(bindName, optional, resolver, spec);
    }
    return isArray ? new CliVarArgumentLoader(spec.rawType().getComponentType(), resolver) : new CliArgumentLoader(resolver);
}
Also used : StringValueResolver(org.osgl.util.StringValueResolver) Required(act.cli.Required) Optional(act.cli.Optional)

Aggregations

Optional (act.cli.Optional)1 Required (act.cli.Required)1 StringValueResolver (org.osgl.util.StringValueResolver)1