org.springframework.cloud.dataflow.shell.command

## Class Assertions

- java.lang.Object
- - org.springframework.cloud.dataflow.shell.command.Assertions

-     public class Assertions
      extends Object

  Various utility methods when dealing with shell commands.
  Author:
    Eric Bottard

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int` | `atMostOneOf(Object... namesAndValues)` Accepts 2*N arguments, even ones being names and odd ones being values for those names.
    `static int` | `exactlyOneOf(Object... namesAndValues)` Accepts 2*N arguments, even ones being names and odd ones being values for those names.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### exactlyOneOf

          public static int exactlyOneOf(Object... namesAndValues)

      Accepts 2*N arguments, even ones being names and odd ones being values for those names. Asserts that exactly only one value is non null (or non-false, Boolean.FALSE being treated as false), or throws an exception with a descriptive message otherwise.
      Parameters:
        `namesAndValues` - the list of names and values
      Returns:
        the index of the "pair" that was not `null`
      Throws:
        `IllegalStateException` - if more than one argument is non null
        `IllegalArgumentException` - if the method is called with invalid values (e.g. non even number of args)

    - #### atMostOneOf

          public static int atMostOneOf(Object... namesAndValues)

      Accepts 2*N arguments, even ones being names and odd ones being values for those names. Asserts that at most one value is non null (or non-false, Boolean.FALSE being treated as false), or throws an exception with a descriptive message otherwise.
      Parameters:
        `namesAndValues` - the list of names and values
      Returns:
        the index of the "pair" that was not `null`, or -1 if none was set
      Throws:
        `IllegalStateException` - if more than one argument is non null
        `IllegalArgumentException` - if the method is called with invalid values (e.g. non even number of args)

Copyright © 2021 Pivotal Software, Inc.. All rights reserved.