Class Assert

java.lang.Object
com.groiss.util.Assert

public class Assert extends Object
Class for defining assertions.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    RuntimeException indicating that an assert failed.
  • Method Summary

    Modifier and Type
    Method
    Description
    static final void
    isFalse(boolean expression)
    Throws an exception if the given expression is true.
    static final void
    isFalse(boolean expression, String message)
    Throws an exception if the given expression is true.
    static final void
    isTrue(boolean expression)
    Throws an exception if the given expression is false.
    static final void
    isTrue(boolean expression, String message)
    Throws an exception if the given expression is false.
    static final void
    Check the presence of parameters
    static final void
    nonNull(Object param, String paramName)
    Throws an exception if the given argument is null.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isTrue

      public static final void isTrue(boolean expression)
      Throws an exception if the given expression is false. Hint: Use the method with extra message parameter isTrue(boolean,String)
      Parameters:
      expression - a boolean expression
    • isFalse

      public static final void isFalse(boolean expression)
      Throws an exception if the given expression is true. Hint: Use the method with extra message parameter isFalse(boolean,String)
      Parameters:
      expression - a boolean expression
    • isTrue

      public static final void isTrue(boolean expression, String message)
      Throws an exception if the given expression is false.
      Parameters:
      expression - a boolean expression
      message - the message of the exception
    • isFalse

      public static final void isFalse(boolean expression, String message)
      Throws an exception if the given expression is true.
      Parameters:
      expression - a boolean expression
      message - the message of the exception
    • nonNull

      public static final void nonNull(Object param, String paramName)
      Throws an exception if the given argument is null.
      Parameters:
      param - an object
      paramName - the name used in the error message
    • necessaryParameters

      public static final void necessaryParameters(HttpServletRequest req, String... names)
      Check the presence of parameters
      Parameters:
      req - the request
      names - list of parameter names