class ReflectUtils {
  private ReflectUtils() {
    throw new IllegalStateException("Utility class");
  }

  public static ObjectMeta objectMetadata(Object obj) throws ReflectiveOperationException {<FILL_FUNCTION_BODY>}

  public static String namespace(Object obj) throws ReflectiveOperationException {
    if (obj == null) {
      return "";
    }
    return objectMetadata(obj).getNamespace();
  }

  public static ListMeta listMetadata(Object listObj) throws ReflectiveOperationException {
    if (listObj instanceof KubernetesResourceList) {
      return ((KubernetesResourceList<?>) listObj).getMetadata();
    }
    try {
      Method mdField = listObj.getClass().getMethod("getMetadata");
      return (ListMeta) mdField.invoke(listObj);
    } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
      throw new ReflectiveOperationException(e);
    }
  }

  public static <ApiType> List<ApiType> getItems(Object listObj) throws ReflectiveOperationException {
    if (listObj instanceof KubernetesResourceList) {
      return ((KubernetesResourceList) listObj).getItems();
    }
    try {
      Method getItemsMethod = listObj.getClass().getMethod("getItems");
      return (List<ApiType>) getItemsMethod.invoke(listObj);
    } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
      throw new ReflectiveOperationException(e);
    }
  }
}

    if (obj == null) {
      return null;
    }
    if (obj instanceof HasMetadata) {
      return ((HasMetadata) obj).getMetadata();
    }
    try {
      Method mdField = obj.getClass().getMethod("getMetadata");
      return (ObjectMeta) mdField.invoke(obj);
    } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
      throw new ReflectiveOperationException(e);
    }
  
<no_super_class>