Java Object to String castToString(Object inValue)

Here you can find the source of castToString(Object inValue)

Description

cast To String

License

Open Source License

Declaration

public static String castToString(Object inValue) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String castToString(Object inValue) {
        return cast(inValue, (String) null);
    }/*from   ww w  .j  a  v  a2s .  c o  m*/

    public static <T> T cast(Object inValue) {
        return cast(inValue, null);
    }

    @SuppressWarnings("unchecked")
    public static <T> T cast(Object inValue, T inDefault) {
        try {
            return (T) inValue;
        } catch (Exception e) {
            return inDefault;
        }
    }
}

Related

  1. castString(Object o)
  2. castString(Object obj)
  3. castString(Object obj, String defaultValue)
  4. castString(Object val)
  5. castToString(Object object)
  6. castToString(Object value)
  7. castToStringArray(Object[] array)
  8. objectToString(final Object value)