Java Null Value Convert convertNullValue(final Class convertType)

Here you can find the source of convertNullValue(final Class convertType)

Description

convert Null Value

License

Apache License

Declaration

private static Object convertNullValue(final Class<?> convertType) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    private static Object convertNullValue(final Class<?> convertType) {
        if ("byte".equals(convertType.getName())) {
            return (byte) 0;
        } else if ("short".equals(convertType.getName())) {
            return (short) 0;
        } else if ("int".equals(convertType.getName())) {
            return 0;
        } else if ("long".equals(convertType.getName())) {
            return 0L;
        } else if ("double".equals(convertType.getName())) {
            return 0D;
        } else if ("float".equals(convertType.getName())) {
            return 0F;
        } else {/*from  w  ww  . j  a  va  2s. co m*/
            return null;
        }
    }
}

Related

  1. convertNullToInteger(Object orgStr, int convertStr)
  2. convertNullToLong(Object orgStr, Long convertStr)
  3. convertNullToOne(final Object value)
  4. convertNullToSolrValue(String fieldName)
  5. convertNullToString(final String str)
  6. null2blank(String prnStr)
  7. null2blank(String source)
  8. null2Boolean(Object expression, boolean defValue)
  9. null2Boolean(Object s)