All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.cyclopsgroup.jcli.impl.DefaultArgumentProcessor Maven / Gradle / Ivy

There is a newer version: 1.0.1
Show newest version
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 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