Class Preconditions


  • public class Preconditions
    extends java.lang.Object
    Utils for checking preconditions and invariants
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void checkEmptyString​(java.lang.String string, java.lang.String errorMsg)
      Checks that a string is not null or empty
      static void checkNotNull​(java.lang.Object object, java.lang.String errorMsg)
      Checks that an object is not null.
      static void checkValidOAuthCallback​(java.lang.String url, java.lang.String errorMsg)
      Checks that a URL is a valid OAuth callback
      static void checkValidUrl​(java.lang.String url, java.lang.String errorMsg)
      Checks that a URL is valid
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • checkNotNull

        public static void checkNotNull​(java.lang.Object object,
                                        java.lang.String errorMsg)
        Checks that an object is not null.
        Parameters:
        object - any object
        errorMsg - error message
        Throws:
        java.lang.IllegalArgumentException - if the object is null
      • checkEmptyString

        public static void checkEmptyString​(java.lang.String string,
                                            java.lang.String errorMsg)
        Checks that a string is not null or empty
        Parameters:
        string - any string
        errorMsg - error message
        Throws:
        java.lang.IllegalArgumentException - if the string is null or empty
      • checkValidUrl

        public static void checkValidUrl​(java.lang.String url,
                                         java.lang.String errorMsg)
        Checks that a URL is valid
        Parameters:
        url - any string
        errorMsg - error message
      • checkValidOAuthCallback

        public static void checkValidOAuthCallback​(java.lang.String url,
                                                   java.lang.String errorMsg)
        Checks that a URL is a valid OAuth callback
        Parameters:
        url - any string
        errorMsg - error message