code: public static <E> E checkInstanceOf(Class<E> type, Object object, String errorMessage) {
          isNotNull(type, "type");
          if (!type.isInstance(object)) {
              throw new IllegalArgumentException(errorMessage);
          }
          return (E) object;
      }
docs: Tests whether the supplied object is an instance of the supplied class type.
  
  @param type         the expected type.
  @param object       the object tested against the expected type.
  @param errorMessage the errorMessage
  @return the object argument.
  @throws java.lang.IllegalArgumentException if the object is not an instance of the expected type.