Class Primitives


  • public final class Primitives
    extends java.lang.Object
    Utilities for handling primitive types and their wrappers uniformly.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static @NotNull java.lang.Object[] arrayAsObjectArray​(@NotNull java.lang.Object o)  
      static <T> @NotNull java.lang.Class<T> unwrap​(@NotNull java.lang.Class<T> type)
      Returns the corresponding primitive type for a wrapper type, or the type itself if it is not a wrapper.
      static <T> @NotNull java.lang.Class<T> wrap​(@NotNull java.lang.Class<T> type)
      Returns the corresponding wrapper type for a primitive type, or the type itself if it is not a primitive type.
      static @NotNull java.lang.reflect.Type wrap​(@NotNull java.lang.reflect.Type type)  
      • Methods inherited from class java.lang.Object

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

      • wrap

        @NotNull
        public static <T> @NotNull java.lang.Class<T> wrap​(@NotNull
                                                           @NotNull java.lang.Class<T> type)
        Returns the corresponding wrapper type for a primitive type, or the type itself if it is not a primitive type.
      • wrap

        @NotNull
        public static @NotNull java.lang.reflect.Type wrap​(@NotNull
                                                           @NotNull java.lang.reflect.Type type)
      • unwrap

        @NotNull
        public static <T> @NotNull java.lang.Class<T> unwrap​(@NotNull
                                                             @NotNull java.lang.Class<T> type)
        Returns the corresponding primitive type for a wrapper type, or the type itself if it is not a wrapper.
      • arrayAsObjectArray

        @NotNull
        public static @NotNull java.lang.Object[] arrayAsObjectArray​(@NotNull
                                                                     @NotNull java.lang.Object o)