public static boolean hasField(Class<?> type,String fieldName){
  try {
    type.getField(fieldName);
    return true;
  }
 catch (  Exception e) {
    return false;
  }
}

public static boolean hasField ( Class < ? > type , String fieldName ) { try { type . getField ( fieldName ) ; return true ; } catch ( Exception e ) { return false ; } }
checks if fieldname is present and accessible in specified type
