public static Primitive getDefaultValue ( Class < ? > type ) { if ( type == null ) return Primitive . NULL ; if ( Boolean . TYPE == type || Boolean . class == type ) return Primitive . FALSE ; if ( Character . TYPE == type || Character . class == type ) return Primitive . ZERO_CHAR ; if ( Byte . TYPE == type || Byte . class == type ) return Primitive . ZERO_BYTE ; if ( Short . TYPE == type || Short . class == type ) return Primitive . ZERO_SHORT ; if ( Integer . TYPE == type || Integer . class == type ) return Primitive . ZERO_INT ; if ( Long . TYPE == type || Long . class == type ) return Primitive . ZERO_LONG ; if ( Float . TYPE == type || Float . class == type ) return Primitive . ZERO_FLOAT ; if ( Double . TYPE == type || Double . class == type ) return Primitive . ZERO_DOUBLE ; if ( BigInteger . class == type ) return Primitive . ZERO_BIG_INTEGER ; if ( BigDecimal . class == type ) return Primitive . ZERO_BIG_DECIMAL ; return Primitive . NULL ; }
Get the appropriate default value per JLS 4 . 5 . 4