code: protected static <T> Class<T> firstKnownType(T... objects) {
          for (T obj : objects)
              if (obj != null)
                  return (Class<T>) obj.getClass();
          return null;
      }
docs: Utility method to allow subclasses to extract type from known variables.