Package org.eclipse.epsilon.eol.cli
Class EolConfigParser<C extends EolRunConfiguration,B extends EolRunConfiguration.Builder<C,B>>
- java.lang.Object
-
- org.eclipse.epsilon.common.cli.ConfigParser<C,B>
-
- org.eclipse.epsilon.eol.cli.EolConfigParser<C,B>
-
- All Implemented Interfaces:
java.util.function.Consumer<java.lang.String[]>
,java.util.function.Function<java.lang.String[],C>
public class EolConfigParser<C extends EolRunConfiguration,B extends EolRunConfiguration.Builder<C,B>> extends ConfigParser<C,B>
A default config getter which effectively allows main method inheritance. Uses reflection to find appropriate constructors and module interface to pass to parseModule method. Please note: The constructors of this class must be inherited in R!
Note that this needn't be subclassed to use it, you can just add the required projects to the classpath and call it with appropriate arguments, but you must provide a module with the -module option.- Since:
- 1.6
- Author:
- Sina Madani
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
modelsOpt
protected java.lang.String
moduleOpt
protected java.lang.String
parallelismOpt
protected java.lang.String
scriptParamsOpt
protected java.lang.String
sequentialOpt
-
Fields inherited from class org.eclipse.epsilon.common.cli.ConfigParser
builder, cmdLine, help, helpOpt, nL, optionalUsage, options, outFileOpt, profileExecutionOpt, repeatsOpt, requiredUsage, runConfig, scriptOpt, showResultsOpt
-
-
Constructor Summary
Constructors Constructor Description EolConfigParser(B builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
main(java.lang.String... args)
Allows the caller to invoke any subclass of IEolModule.protected void
parseArgs(java.lang.String[] args)
static java.util.Map<IModel,StringProperties>
parseModelParameters(java.lang.String[] arguments)
protected static <R extends IEolModule>
RparseModule(java.lang.String[] args)
Attempts to parse a module from command-line arguments, based on assumptions on Epsilon's conventional naming schemes and package structure.static java.util.Map<java.lang.String,java.lang.Object>
parseScriptParameters(java.lang.String[] arguments)
-
Methods inherited from class org.eclipse.epsilon.common.cli.ConfigParser
accept, apply, formatUsage, handleException, parseAndRun, tryParse, tryParse, tryParse, tryParse
-
-
-
-
Field Detail
-
moduleOpt
protected final java.lang.String moduleOpt
- See Also:
- Constant Field Values
-
modelsOpt
protected final java.lang.String modelsOpt
- See Also:
- Constant Field Values
-
scriptParamsOpt
protected final java.lang.String scriptParamsOpt
- See Also:
- Constant Field Values
-
parallelismOpt
protected final java.lang.String parallelismOpt
- See Also:
- Constant Field Values
-
sequentialOpt
protected final java.lang.String sequentialOpt
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EolConfigParser
public EolConfigParser(B builder)
-
-
Method Detail
-
main
public static void main(java.lang.String... args) throws java.lang.ClassNotFoundException
Allows the caller to invoke any subclass of IEolModule.- Throws:
java.lang.ClassNotFoundException
-
parseArgs
protected void parseArgs(java.lang.String[] args) throws java.lang.Exception
- Overrides:
parseArgs
in classConfigParser<C extends EolRunConfiguration,B extends EolRunConfiguration.Builder<C,B>>
- Throws:
java.lang.Exception
-
parseModelParameters
public static java.util.Map<IModel,StringProperties> parseModelParameters(java.lang.String[] arguments) throws java.lang.Exception
- Throws:
java.lang.Exception
-
parseScriptParameters
public static java.util.Map<java.lang.String,java.lang.Object> parseScriptParameters(java.lang.String[] arguments)
-
parseModule
protected static <R extends IEolModule> R parseModule(java.lang.String[] args) throws java.lang.IllegalArgumentException
Attempts to parse a module from command-line arguments, based on assumptions on Epsilon's conventional naming schemes and package structure. The names are based on the class name of the return type; so for example for IEolModule, it will use "ERL" as the language and look for the appropriate modules and contexts based on this name.- Parameters:
args
- the name of the module (following org.eclipse.epsilon.) followed by an even-arity array with arguments to provide to the context constructor, where every even numbered argument (including 0) is the class (type) and every odd numbered argument is the value. Note: only types with a String constructor are valid.- Throws:
java.lang.IllegalArgumentException
-
-