Klasse ObjectUtil

java.lang.Object
com.restfb.util.ObjectUtil

public class ObjectUtil extends Object
  • Methodendetails

    • requireNotEmpty

      public static String requireNotEmpty(String obj, String errorText)
      Ensures that obj isn't null or an empty string.
      Parameter:
      obj - The parameter to check.
      errorText - The exception message.
      Löst aus:
      IllegalArgumentException - If obj is null or an empty string.
    • requireNotEmpty

      public static void requireNotEmpty(Collection<?> collection, String errorText)
    • requireNotNull

      public static <T extends Exception> void requireNotNull(Object obj, Supplier<T> exceptionSupplier) throws T
      Ensures that obj isn't null.
      Parameter:
      obj - The parameter to check.
      exceptionSupplier - The supplier for the exception that is thrown if obj is null.
      Löst aus:
      T - If obj is null.
    • isEmptyCollectionOrMap

      public static boolean isEmptyCollectionOrMap(Object obj)
      Checks is the object is a empty 'collection' or 'map'.
      Parameter:
      obj - the object that is checked
      Gibt zurück:
      true if the given object is a empty collection or an empty map, false otherwise
    • verifyParameterPresence

      public static void verifyParameterPresence(String parameterName, String parameter)
      Ensures that parameter isn't null or an empty string.
      Parameter:
      parameterName - The name of the parameter (to be used in exception message).
      parameter - The parameter to check.
      Löst aus:
      IllegalArgumentException - If parameter is null or an empty string.
    • verifyParameterPresence

      public static void verifyParameterPresence(String parameterName, Object parameter)
      Ensures that parameter isn't null.
      Parameter:
      parameterName - The name of the parameter (to be used in exception message).
      parameter - The parameter to check.
      Löst aus:
      NullPointerException - If parameter is null.