Class Utils


  • public class Utils
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.nio.charset.Charset CHARSET_UTF8  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T checkNotNull​(T reference)
      Ensures that an object reference passed as a parameter to the calling method is not null.
      static java.lang.String mapToUrlEncodedString​(java.util.Map<java.lang.String,​java.lang.String> data)
      Creates an urlencoded string from the given data.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • CHARSET_UTF8

        public static java.nio.charset.Charset CHARSET_UTF8
    • Method Detail

      • checkNotNull

        public static <T> T checkNotNull​(T reference)
        Ensures that an object reference passed as a parameter to the calling method is not null.
        Parameters:
        reference - an object reference
        Returns:
        the non-null reference that was validated
        Throws:
        java.lang.NullPointerException - if reference is null
      • mapToUrlEncodedString

        public static java.lang.String mapToUrlEncodedString​(java.util.Map<java.lang.String,​java.lang.String> data)
        Creates an urlencoded string from the given data. The created string can be used as a query string or the request body of a x-www-form-urlencoded form.
        Parameters:
        data - A map where the key is the name of the query parameter and the value is the parameter's value.
        Returns:
        The urlencoded data.