Class Preconditions


  • public class Preconditions
    extends Object
    Utils for checking preconditions and invariants
    • Method Detail

      • checkNotNull

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

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

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

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