-
Notifications
You must be signed in to change notification settings - Fork 2k
Update BaseRestHandler to implement default routes #694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
In this case |
routes() method is from interface RestHandler, which already has default implementation here. if we remove this method from BaseRestHandler, we don't have to override at subclass extending BaseRestHandler. |
Can we have a way to enforce one of routes or replacedRoute as I don't think a RestHandler should exist without a route. This proposal can allow the plugin implementation to get away without providing any of them which breaks the contract |
Such a contract can't be enforced by Java. Any subclass that implements |
Describe the bug
Update BaseRestHandler to implement default routes() instead of an abstract class.
This will help developers not to implement empty methods even though they don't need it.
They can always override the method if they'd like.
OpenSearch/server/src/main/java/org/opensearch/rest/BaseRestHandler.java
Line 102 in 0ba0e7c
Expected behavior
Return an empty list so that classes which extend do not have implement empty methods even if they don't have to.
Plugins
OpenSearch Anomaly-Detection
Host/Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: