Here you can find the source of as(Class
public static <T> T as(Class<T> t, Object o)
//package com.java2s; //License from project: Open Source License public class Main { public static <T> T as(Class<T> t, Object o) { return t.isInstance(o) ? t.cast(o) : null; }//from w w w .ja v a 2 s.c o m }