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

uk.co.flamingpenguin.jewel.cli.CliFactory Maven / Gradle / Ivy

package uk.co.flamingpenguin.jewel.cli;

/**
 * 

* Constructs a Cli from an annotated interface definition. *

* * @deprecated please use {@link com.lexicalscope.jewel.cli.CliFactory} instead * * @see uk.co.flamingpenguin.jewel.cli.Option * * @author Tim Wood */ @Deprecated public abstract class CliFactory { /** * Construct a Cli from an annotated interface definition * * @param * The type of the interface that will be used to present the * arguments * @param klass * The annotated interface definition * * @return A Cli configured to create instance of klass */ public static Cli createCli(final Class klass) { return new CliInterfaceImpl(klass); } /** * Construct a Cli from an annotated class * * @param * The type of the class used to present the arguments * @param options * The annotated class * * @return A Cli configured to configure the options */ public static Cli createCliUsingInstance(final O options) { return new CliInstanceImpl(options); } /** * Parse arguments from an annotated interface definition * * @param * The type of the interface that will be used to present the * arguments * @param klass * The annotated interface definition * @param arguments * * @return The parsed arguments * * @throws InvalidArgumentsException * @throws ArgumentValidationException */ public static O parseArguments(final Class klass, final String... arguments) throws ArgumentValidationException { return createCli(klass).parseArguments(arguments); } /** * Parse arguments from an annotated class instance * * @param * The type of the class used to present the arguments * @param klass * The annotated interface definition * @param arguments * * @return The parsed arguments * * @throws InvalidArgumentsException * @throws ArgumentValidationException */ public static O parseArgumentsUsingInstance(final O options, final String... arguments) throws ArgumentValidationException { return createCliUsingInstance(options).parseArguments(arguments); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy