Class ObjectHelper


  • public final class ObjectHelper
    extends java.lang.Object
    Utility methods containing the backport of Java 7's Objects utility class.

    Named as such to avoid clash with java.util.Objects.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) static BiPredicate<java.lang.Object,​java.lang.Object> EQUALS  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ObjectHelper()
      Utility class.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> BiPredicate<T,​T> equalsPredicate()
      Returns a BiPredicate that compares its parameters via Objects.equals().
      static int verifyPositive​(int value, java.lang.String paramName)
      Validate that the given value is positive or report an IllegalArgumentException with the parameter name.
      static long verifyPositive​(long value, java.lang.String paramName)
      Validate that the given value is positive or report an IllegalArgumentException with the parameter name.
      • Methods inherited from class java.lang.Object

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

      • EQUALS

        static final BiPredicate<java.lang.Object,​java.lang.Object> EQUALS
    • Constructor Detail

      • ObjectHelper

        private ObjectHelper()
        Utility class.
    • Method Detail

      • equalsPredicate

        public static <T> BiPredicate<T,​T> equalsPredicate()
        Returns a BiPredicate that compares its parameters via Objects.equals().
        Type Parameters:
        T - the value type
        Returns:
        the bi-predicate instance
      • verifyPositive

        public static int verifyPositive​(int value,
                                         java.lang.String paramName)
        Validate that the given value is positive or report an IllegalArgumentException with the parameter name.
        Parameters:
        value - the value to validate
        paramName - the parameter name of the value
        Returns:
        value
        Throws:
        java.lang.IllegalArgumentException - if bufferSize <= 0
      • verifyPositive

        public static long verifyPositive​(long value,
                                          java.lang.String paramName)
        Validate that the given value is positive or report an IllegalArgumentException with the parameter name.
        Parameters:
        value - the value to validate
        paramName - the parameter name of the value
        Returns:
        value
        Throws:
        java.lang.IllegalArgumentException - if bufferSize <= 0