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 using DslValues.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 Detail

      • valuesAsGroup

        RepeatingGroup[] valuesAsGroup​(java.lang.String groupName)
        Retrieve the set of values supplied for a RepeatingArgGroup or an empty array if no values were supplied. RepeatingArgGroup requires that it's first argument be a RequiredArg and 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 RepeatingGroup instances, one for each set of values supplied for the argument.
        Throws:
        java.lang.IllegalArgumentException - if name does not match the name of a RepeatingArgGroup.
      • create

        static DslParams create​(java.lang.String[] args,
                                DslArg... arguments)
        Create new DslParams.
        Parameters:
        args - the values
        arguments - the args
        Returns:
        the new DslParams
      • getSingleRequiredParamValue

        static java.lang.String getSingleRequiredParamValue​(java.lang.String[] args,
                                                            java.lang.String requiredParamName)
        A shorthand way to create a DslParams instance 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.