Here you can find the source of cast(Object inValue)
public static <T> T cast(Object inValue)
//package com.java2s; //License from project: Open Source License public class Main { public static <T> T cast(Object inValue) { return cast(inValue, null); }//from w w w.j a va 2s.c o m @SuppressWarnings("unchecked") public static <T> T cast(Object inValue, T inDefault) { try { return (T) inValue; } catch (Exception e) { return inDefault; } } }