-
Notifications
You must be signed in to change notification settings - Fork 315
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
Changes in API-interfaces regarding return types #1034
Comments
I like that idea. What would this look like? |
I was thinking of something like this: interface OWLOntologyManager {
OntologyConfig getOntologyConfigurator();
}
interface OntologyConfig {
OntologyConfig setBoolean(Key key, boolean value);
boolean getBoolean(Key key);
@Deprecated // ?
default OntologyConfig setAcceptingHTTPCompression(boolean b) {
return setBoolean(OWLAPISettings.BOOLEAN_ACCEPT_HTTP_COMPRESSION, b);
}
@Deprecated // ?
default boolean shouldAcceptHTTPCompression() {
return getBoolean(OWLAPISettings.BOOLEAN_ACCEPT_HTTP_COMPRESSION);
}
interface Key {
}
}
enum OWLAPISettings implements OntologyConfig.Key {
BOOLEAN_ACCEPT_HTTP_COMPRESSION,
} I think, such a configuration should be much easier to override and extend across implementations. |
Why not simplify further and just have a |
I think that wouldn't be very user-friendly:
But on the other hand, I agree that the configuration management code is overly complicated, and switching to use |
I think, it would be better to replace all the concrete modifiable classes from interfaces with interfaces as well.
Basically, it's about the return types mentioned in the
org.semanticweb.owlapi.model.OWLOntologyManager
, i.e. about the followings:org.semanticweb.owlapi.model.OntologyConfigurator
(ONT-API has extended configuration)org.semanticweb.owlapi.model.OWLOntologyLoaderConfiguration
org.semanticweb.owlapi.model.OWLOntologyWriterConfiguration
org.semanticweb.owlapi.util.PriorityCollection
(or replace it withjava.util.Collection
)I think this also would be more correct in terms of architecture\design:
it is better when interface methods do not return mutable non-final concrete classes.
In order not to interfere with the current client code, this could be done somewhere in version 5.2+
v6.x.x, I think, implies more deep changes, while these proposed changes may not be even visible to end-users (to notice, it is need to have code calling constructors directly).
And also, generally speaking, it would be better to make a generic mechanism to retrieve\set configuration that would not depend on implementation at all.
Originally it was posted here: https://github.com/orgs/owlcs/teams/ontapi-contributors/discussions/1
The text was updated successfully, but these errors were encountered: