Abyss-lord commented on code in PR #6461: URL: https://github.com/apache/gravitino/pull/6461#discussion_r1960902913
########## clients/cli/src/main/java/org/apache/gravitino/cli/outputs/PlainFormat.java: ########## @@ -21,71 +21,247 @@ import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; +import org.apache.gravitino.Audit; import org.apache.gravitino.Catalog; import org.apache.gravitino.Metalake; +import org.apache.gravitino.Schema; +import org.apache.gravitino.cli.CommandContext; +import org.apache.gravitino.rel.Table; -/** Plain format to print a pretty string to standard out. */ -public class PlainFormat { - public static void output(Object object) { - if (object instanceof Metalake) { - new MetalakePlainFormat().output((Metalake) object); - } else if (object instanceof Metalake[]) { - new MetalakesPlainFormat().output((Metalake[]) object); - } else if (object instanceof Catalog) { - new CatalogPlainFormat().output((Catalog) object); - } else if (object instanceof Catalog[]) { - new CatalogsPlainFormat().output((Catalog[]) object); +/** + * Formats entity into plain text representation for command-line output. Supports formatting of + * single objects and arrays of Metalake, Catalog, Schema, and Table objects. Each supported type + * has its own specialized formatter as an inner class. + */ +public abstract class PlainFormat<T> extends BaseOutputFormat<T> { + + /** + * Routes the object to its appropriate formatter and outputs the formatted result. Creates a new + * formatter instance for the given object type and delegates the formatting. + * + * @param entity The object to format + * @param context The command context + * @throws IllegalArgumentException if the object type is not supported + */ + public static void output(Object entity, CommandContext context) { + if (entity instanceof Metalake) { Review Comment: @tengqm JDK8 does not support pattern matching. So we can't use switch-case overwriting. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@gravitino.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org