GWT work-around for missing Class.isInstance()

前端 未结 2 2016
花落未央
花落未央 2021-01-02 10:07

I\'m trying to write a job scheduling system in GWT that maintains an array of exceptions (Class[] exceptions), that might be resolve

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-02 10:39

    I use following code:

     public static  boolean isInstanceOf(Class type, Object object) {
        try {
             T objectAsType = (T) object;
         } catch (ClassCastException exception) {
             return false;
         }
         return true;
     }
    

提交回复
热议问题