Class Assertions

java.lang.Object
org.wildfly.plugin.tools.util.Assertions

public class Assertions extends Object
A utility for assertions.
Author:
James R. Perkins
  • Constructor Details

    • Assertions

      public Assertions()
  • Method Details

    • checkNotNullParam

      public static <T> T checkNotNullParam(String parameterName, T value)
      Checks if the value is null and throws an IllegalArgumentException if it is. Otherwise, the value itself is returned.
      Type Parameters:
      T - the type of the value
      Parameters:
      parameterName - the name of the parameter to check
      value - the value to check
      Returns:
      the value if not null
      Throws:
      IllegalArgumentException - if the object representing the parameter is null
    • requiresNotNullOrNotEmptyParameter

      public static String requiresNotNullOrNotEmptyParameter(String name, String value) throws IllegalArgumentException
      Checks if the parameter is null or empty and throws an IllegalArgumentException if it is.
      Parameters:
      name - the name of the parameter
      value - the value to check
      Returns:
      the parameter value
      Throws:
      IllegalArgumentException - if the object representing the parameter is null
    • requiresNotNullOrNotEmptyParameter

      public static <E, T extends Collection<E>> T requiresNotNullOrNotEmptyParameter(String name, T value) throws IllegalArgumentException
      Checks if the parameter is null or empty and throws an IllegalArgumentException if it is.
      Parameters:
      name - the name of the parameter
      value - the value to check
      Returns:
      the parameter value
      Throws:
      IllegalArgumentException - if the object representing the parameter is null