Here you can find the source of as(Class
public static <T, I> T as(Class<T> clazz, I instance)
//package com.java2s; //License from project: LGPL public class Main { public static <T, I> T as(Class<T> clazz, I instance) { return clazz.cast(instance); }/* ww w . ja va 2 s. co m*/ }