org.cyclopsgroup.jcli.impl.DefaultArgumentProcessor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jcli Show documentation
Show all versions of jcli Show documentation
Annotation based command line arguments parser
package org.cyclopsgroup.jcli.impl;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import org.cyclopsgroup.jcli.ArgumentProcessor;
import org.cyclopsgroup.jcli.ValidationResult;
import org.cyclopsgroup.jcli.spi.CommandLineParser;
import org.cyclopsgroup.jcli.spi.ParsingContext;
class DefaultArgumentProcessor extends ArgumentProcessor {
static final String ARGUMENT_REFERNCE_NAME = "----arguments----";
private final AnnotationParsingContext context;
private final CommandLineParser parser;
DefaultArgumentProcessor(Class extends T> beanType, CommandLineParser parser) {
this.parser = parser;
context = new ParsingContextBuilder(beanType).build();
}
@Override
public ParsingContext createParsingContext() {
return context;
}
AnnotationParsingContext getContext() {
return context;
}
@Override
public void printHelp(PrintWriter out) throws IOException {
DefaultHelpPrinter.printHelp(context, out);
}
@Override
public void process(List arguments, T bean) {
DefaultBeanProcessor.process(context, arguments, bean, parser);
}
@Override
public ValidationResult validate(String[] arguments) {
// TODO Auto-generated method stub
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy