Class ObjectUtils

java.lang.Object
io.micronaut.core.util.ObjectUtils

@Internal public final class ObjectUtils extends Object

Utility methods for working with objects

.
Since:
4.0
Author:
Denis Stepanov
  • Method Details

    • hash

      public static int hash(@Nullable @Nullable Object o1, @Nullable @Nullable Object o2)
      Hashing method. Alternative to Objects.hash(Object...) without allocating an array.
      Parameters:
      o1 - The object 1
      o2 - The object 2
      Returns:
      The hash
      Since:
      4.0.0
    • hash

      public static int hash(@Nullable @Nullable Object o1, @Nullable @Nullable Object o2, @Nullable @Nullable Object o3)
      Hashing method. Alternative to Objects#hash(Object...) without allocating an array.
      Parameters:
      o1 - The object 1
      o2 - The object 2
      o3 - The object 3
      Returns:
      The hash
      Since:
      4.0.0
    • coerceToBoolean

      public static boolean coerceToBoolean(@Nullable @Nullable Object object)
      Coerce the given object to boolean. The following cases are handled:
      1. null results in false
      2. empty strings result in false
      3. positive numbers are true
      4. empty collections, arrays, optionals and maps are false
      Parameters:
      object - The object
      Returns:
      The boolean
      Since:
      4.0.0