`

Object to genericty

    博客分类:
  • JAVA
 
阅读更多

public T getGenericity(Object o, Class<T> type){

 

   if(type.isInstance(O)){

      type.cast(o);

  }

 return null;

}

 

so we can use it like this :

 

  User s = getGenericity(userObject,User.class);

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics