All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.minlia.cloud.exception.Assertion Maven / Gradle / Ivy

The newest version!
package com.minlia.cloud.exception;

/**
 * @author will
 */
public class Assertion {


  public static void is(Boolean expression, Integer code) {
    if (expression) {
      throw new ApiException(code);
    }
  }


  public static void not(Boolean expression, Integer code) {
    is(!expression, code);
  }

  public static  T isNull(T reference, Integer code, Object... arguments) {
    if (null == reference) {
      throw new ApiException(code);
    } else {
      return reference;
    }
  }

  public static void throwNewApiException(Integer code) {
    throw new ApiException(code);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy