code: private Class detectClass(final Object object) {
          if (object instanceof Class) {
              return (Class) object;
          }
          return object.getClass();
      }
docs: Method detects the class of the given instance. In case the instance itself is the class these one is directly returned.
  
  @param object
  @return