Java Null Value Convert convertNullToInteger(Object orgStr, int convertStr)

Here you can find the source of convertNullToInteger(Object orgStr, int convertStr)

Description

: convertNullToInt

License

Apache License

Parameter

Parameter Description

Exception

Parameter Description

Return

int

Declaration

public static int convertNullToInteger(Object orgStr, int convertStr) 

Method Source Code

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

public class Main {

    public static int convertNullToInteger(Object orgStr, int convertStr) {
        if (orgStr == null) {
            return convertStr;
        } else {/*from  w w w.  j a  va  2s  .co  m*/
            return Integer.valueOf(orgStr.toString());
        }
    }

    public static String toString(Object[] objArr) {
        if (objArr == null) {
            return null;
        }

        StringBuffer buf = new StringBuffer("[");
        for (int i = 0; i < objArr.length; i++) {
            buf.append((i > 0 ? "," : "") + objArr[i]);
        }
        buf.append("]");
        return buf.toString();
    }

    public static String toString(Object obj) {
        if (obj instanceof String) {
            return "\"" + obj + "\"";
        }
        if (obj instanceof Object[]) {
            return toString((Object[]) obj);
        } else {
            return String.valueOf(obj);
        }
    }
}

Related

  1. convertNullToEmptyStr(String inObj)
  2. convertNullToEmptyString(Object raw)
  3. convertNullToEmptyString(String s)
  4. convertNullToEmptyString(String value)
  5. convertNullToFalse(Boolean b)
  6. convertNullToLong(Object orgStr, Long convertStr)
  7. convertNullToOne(final Object value)
  8. convertNullToSolrValue(String fieldName)
  9. convertNullToString(final String str)