Class Primitives

java.lang.Object
com.google.common.primitives.Primitives

@Deprecated(since="2022-12-01") public final class Primitives extends Object
Deprecated.
The Google Guava Core Libraries are deprecated and will not be part of the AEM SDK after April 2023
Contains static utility methods pertaining to primitive types and their corresponding wrapper types.
Since:
1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    static Set<Class<?>>
    Deprecated.
    Returns an immutable set of all nine primitive types (including void).
    static Set<Class<?>>
    Deprecated.
    Returns an immutable set of all nine primitive-wrapper types (including Void).
    static boolean
    Deprecated.
    Returns true if type is one of the nine primitive-wrapper types, such as Integer.
    static <T> Class<T>
    unwrap(Class<T> type)
    Deprecated.
    Returns the corresponding primitive type of type if it is a wrapper type; otherwise returns type itself.
    static <T> Class<T>
    wrap(Class<T> type)
    Deprecated.
    Returns the corresponding wrapper type of type if it is a primitive type; otherwise returns type itself.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • allPrimitiveTypes

      public static Set<Class<?>> allPrimitiveTypes()
      Deprecated.
      Returns an immutable set of all nine primitive types (including void). Note that a simpler way to test whether a Class instance is a member of this set is to call Class.isPrimitive().
      Since:
      3.0
    • allWrapperTypes

      public static Set<Class<?>> allWrapperTypes()
      Deprecated.
      Returns an immutable set of all nine primitive-wrapper types (including Void).
      Since:
      3.0
    • isWrapperType

      public static boolean isWrapperType(Class<?> type)
      Deprecated.
      Returns true if type is one of the nine primitive-wrapper types, such as Integer.
      See Also:
    • wrap

      public static <T> Class<T> wrap(Class<T> type)
      Deprecated.
      Returns the corresponding wrapper type of type if it is a primitive type; otherwise returns type itself. Idempotent.
           wrap(int.class) == Integer.class
           wrap(Integer.class) == Integer.class
           wrap(String.class) == String.class
       
    • unwrap

      public static <T> Class<T> unwrap(Class<T> type)
      Deprecated.
      Returns the corresponding primitive type of type if it is a wrapper type; otherwise returns type itself. Idempotent.
           unwrap(Integer.class) == int.class
           unwrap(int.class) == int.class
           unwrap(String.class) == String.class