Here you can find the source of castToString(Object inValue)
public static String castToString(Object inValue)
//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; } } }