Package com.lmax.simpledsl.api
Interface DslParams
-
- All Superinterfaces:
DslValues
public interface DslParams extends DslValues
The main entry point for defining the DSL language. Create a DslParams instance with the supplied arguments and the supported params. The supplied values can then be retrieved usingDslValues.value(String)and related methods.public void createUser(String... args) { DslParams params = new DslParams(args, new RequiredParam("user"), new OptionalParam("password")); getDriver().createUser(params.value("user"), params.valueAsOptional("password")); }
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static DslParamscreate(java.lang.String[] args, DslArg... arguments)Create newDslParams.static java.lang.StringgetSingleRequiredParamValue(java.lang.String[] args, java.lang.String requiredParamName)A shorthand way to create aDslParamsinstance that accepts a single required parameter and return the value that was supplied for that parameter.RepeatingGroup[]valuesAsGroup(java.lang.String groupName)Retrieve the set of values supplied for aRepeatingArgGroupor an empty array if no values were supplied.-
Methods inherited from interface com.lmax.simpledsl.api.DslValues
getParams, hasParam, hasParamAndValue, hasValue, value, valueAs, valueAs, valueAsBigDecimal, valueAsBoolean, valueAsDouble, valueAsInt, valueAsLong, valueAsOptional, valueAsOptionalOf, valueAsParam, valueAsParamNamed, values, valuesAs, valuesAs, valuesAs, valuesAsBigDecimals, valuesAsDoubles, valuesAsInts, valuesAsList, valuesAsListOf, valuesAsLongs, valuesAsOptional, valuesAsOptionalDouble, valuesAsOptionalInt, valuesAsOptionalLong
-
-
-
-
Method Detail
-
valuesAsGroup
RepeatingGroup[] valuesAsGroup(java.lang.String groupName)
Retrieve the set of values supplied for aRepeatingArgGroupor an empty array if no values were supplied.RepeatingArgGrouprequires that it's first argument be aRequiredArgand the group as a whole is referenced using the name of that argument. e.g.DslParams params = new DslParams(args, new RepeatingArgGroup( new RequiredArg("user"), new OptionalArg("password"))); RepeatingGroup[] usersToCreate = params.valuesAsGroup("user");- Parameters:
groupName- the name of the first required parameter.- Returns:
- an array of
RepeatingGroupinstances, one for each set of values supplied for the argument. - Throws:
java.lang.IllegalArgumentException- ifnamedoes not match the name of aRepeatingArgGroup.
-
getSingleRequiredParamValue
static java.lang.String getSingleRequiredParamValue(java.lang.String[] args, java.lang.String requiredParamName)A shorthand way to create aDslParamsinstance that accepts a single required parameter and return the value that was supplied for that parameter.- Parameters:
args- the arguments supplied by the test.requiredParamName- the name of the required parameter.- Returns:
- the value supplied for the parameter.
-
-