Class Defaults


  • @GwtIncompatible
    public final class Defaults
    extends java.lang.Object
    This class provides default values for all Java types, as defined by the JLS.
    Since:
    1.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.Map<java.lang.Class<?>,​java.lang.Object> DEFAULTS  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Defaults()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T defaultValue​(java.lang.Class<T> type)
      Returns the default value of type as defined by JLS --- 0 for numbers, false for boolean and '\0' for char.
      private static <T> void put​(java.util.Map<java.lang.Class<?>,​java.lang.Object> map, java.lang.Class<T> type, T value)  
      • Methods inherited from class java.lang.Object

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

      • DEFAULTS

        private static final java.util.Map<java.lang.Class<?>,​java.lang.Object> DEFAULTS
    • Constructor Detail

      • Defaults

        private Defaults()
    • Method Detail

      • put

        private static <T> void put​(java.util.Map<java.lang.Class<?>,​java.lang.Object> map,
                                    java.lang.Class<T> type,
                                    T value)
      • defaultValue

        @Nullable
        public static <T> T defaultValue​(java.lang.Class<T> type)
        Returns the default value of type as defined by JLS --- 0 for numbers, false for boolean and '\0' for char. For non-primitive types and void, null is returned.