Package com.lmax.simpledsl.api
Class RepeatingArgGroup
- java.lang.Object
-
- com.lmax.simpledsl.api.RepeatingArgGroup
-
- All Implemented Interfaces:
DslArg
public class RepeatingArgGroup extends java.lang.Object implements DslArg
Define a group of arguments that can be repeated 0 or more times.The first argument in the group must be a
RequiredArgand is used to identify the start of the group in arguments and when retrieving the groups fromDslParams.valuesAsGroup(String). Other argument may follow the first argument in any order.Multiple
RepeatingArgGroupscan be used within the sameDslParamsbut they cannot be nested.public void createUsers(String... args) { DslParams params = new DslParams( args, new RepeatingParamGroup( new RequiredParam("user"), new OptionalParam("password").setDefault("aPassword") )); for (RepeatingGroup user : params.valueAsGroup("user")) { driver.createUser(user.value("user"), user.value("password")); } }
-
-
Constructor Summary
Constructors Constructor Description RepeatingArgGroup(RequiredArg firstArg, SimpleDslArg... otherArgs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String[]getAllowedValues()Get the specific values that this argument will accept.java.lang.StringgetDefaultValue()Get a default value for this argument.RequiredArggetIdentity()Get theRequiredArgthat identifies thisRepeatingArgGroup.java.lang.StringgetMultipleValueSeparator()Get the separator that can be used to separate multiple values.java.lang.StringgetName()Get the name of this argument.SimpleDslArg[]getOtherArgs()booleanisAllowMultipleValues()Check whether this argument can take multiple values.booleanisRequired()Determine if a value is required for this argument.
-
-
-
Constructor Detail
-
RepeatingArgGroup
public RepeatingArgGroup(RequiredArg firstArg, SimpleDslArg... otherArgs)
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:DslArgGet the name of this argument.
-
isRequired
public boolean isRequired()
Description copied from interface:DslArgDetermine if a value is required for this argument.- Specified by:
isRequiredin interfaceDslArg- Returns:
- true if and only if this argument is required.
-
getDefaultValue
public java.lang.String getDefaultValue()
Description copied from interface:DslArgGet a default value for this argument.If the argument is required, this method will throw an
IllegalArgumentException.- Specified by:
getDefaultValuein interfaceDslArg- Returns:
- the default value for the argument
-
isAllowMultipleValues
public boolean isAllowMultipleValues()
Description copied from interface:DslArgCheck whether this argument can take multiple values.- Specified by:
isAllowMultipleValuesin interfaceDslArg- Returns:
- true if and only if the argument takes multiple values.
-
getMultipleValueSeparator
public java.lang.String getMultipleValueSeparator()
Description copied from interface:DslArgGet the separator that can be used to separate multiple values.- Specified by:
getMultipleValueSeparatorin interfaceDslArg- Returns:
- the separator for splitting multiple values.
-
getAllowedValues
public java.lang.String[] getAllowedValues()
Description copied from interface:DslArgGet the specific values that this argument will accept.- Specified by:
getAllowedValuesin interfaceDslArg- Returns:
- the values allowed by this argument, or null if all values are allowed
-
getIdentity
public RequiredArg getIdentity()
Get theRequiredArgthat identifies thisRepeatingArgGroup.- Returns:
- the
RequiredArg.
-
getOtherArgs
public SimpleDslArg[] getOtherArgs()
- Returns:
- the
DslArgs.
-
-