Here you can find the source of convertObjectToBean(Object obj, Class
@SuppressWarnings("unchecked") public static <T> T convertObjectToBean(Object obj, Class<T> clazz)
//package com.java2s; //License from project: Apache License public class Main { @SuppressWarnings("unchecked") public static <T> T convertObjectToBean(Object obj, Class<T> clazz) { if (obj != null && clazz.isInstance(obj)) { return (T) obj; }/*from w ww . j a va 2 s .c om*/ return null; } }