jerryshao commented on code in PR #4090:
URL: https://github.com/apache/gravitino/pull/4090#discussion_r1666763848
##########
core/src/main/java/com/datastrato/gravitino/catalog/SchemaDispatcher.java:
##########
@@ -26,4 +26,26 @@
* to dispatching or handling schema-related events or actions that are not
covered by the standard
* {@code SupportsSchemas} operations.
*/
-public interface SchemaDispatcher extends SupportsSchemas {}
+public interface SchemaDispatcher extends SupportsSchemas {
+
+ /**
+ * Wraps the given {@link SchemaOperationDispatcher} with additional
behaviors or operations. This
+ * method returns the same {@link SchemaOperationDispatcher} passed as a
parameter to allow for
+ * chainable method calls. For example:
dispatcherA.wrap(dispatcherB).wrap(dispatcherC)
+ *
+ * @param operationDispatcher The {@link SchemaOperationDispatcher} to wrap.
This is the object
+ * that additional behaviors are applied to. It should not be {@code
null}.
+ * @return The same {@link SchemaOperationDispatcher} instance passed in as
the parameter.
+ */
+ default SchemaDispatcher wrap(SchemaDispatcher operationDispatcher) {
+ return operationDispatcher;
+ }
+
+ /**
+ * Returns a {@link SchemaDispatcher} that delegates the schema operations
to the previously
+ * wrapped {@link SchemaOperationDispatcher}.
+ *
+ * @return The {@link SchemaDispatcher} to delegate the schema operations to.
+ */
+ SchemaDispatcher delegate();
Review Comment:
Can you give me an example to how to use it, to extend to add more methods
that are not defined in `SupportsScheams`?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]