public class CommandLineArgsFactory extends Object
CommandLineArgs
depending on
what type of arguments are available (e.g. a list of args may return a different concrete class
than a single arg)
This should be the public way to construct CommandLineArgs
objects.
Constructor and Description |
---|
CommandLineArgsFactory() |
Modifier and Type | Method and Description |
---|---|
static CommandLineArgs |
from(com.google.common.collect.ImmutableList<Object> args)
Create a
CommandLineArgs instance for a list of arguments |
static CommandLineArgs |
from(com.google.common.collect.ImmutableList<Object> args,
String formatString)
Create a
CommandLineArgs instance for a list of arguments |
static String |
validateFormatString(String formatString)
Throws an exception if the
formatString is not a valid stringification format string |
public static String validateFormatString(String formatString) throws CommandLineArgException
formatString
is not a valid stringification format stringCommandLineArgException
public static CommandLineArgs from(com.google.common.collect.ImmutableList<Object> args) throws CommandLineArgException
CommandLineArgs
instance for a list of argumentsargs
- the list of primitive command line argsCommandLineArgs
object for this collection of argsCommandLineArgException
- if args
contains an arg with an invalid typepublic static CommandLineArgs from(com.google.common.collect.ImmutableList<Object> args, String formatString) throws CommandLineArgException
CommandLineArgs
instance for a list of argumentsargs
- the list of primitive command line argsformatString
- the format string to apply after stringifying argumentsCommandLineArgs
object for this collection of argsCommandLineArgException
- if args
contains an arg with an invalid type