-
Notifications
You must be signed in to change notification settings - Fork 1.3k
ContextConfiguration class is package-private in SimpleElasticsearchPersistentEntity #2114
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
Basically I consider The problem with having this many public classes in a library is, that when users miss some functionality, they tend to derive from and extend these classes, which in the long run makes it for the maintainers of a library harder to refactor, improve and add functionality to these classes without breaking things for people who derived from these classes. I'd prefer if there is a problem or a missing functionality to have an issue opened where this problem can be discussed, and instead of having a local workaround it would be preferable to add missing functionality by contributing to Spring Data Elasticsearch . |
fixed and backported to 4.3.x branch |
Thank you @sothawo for the fix. I totally agree with you that encapsulation is better for libraries and gives maintainers more freedom with future refactorings. Also each public class - as you wrote - could be used by someone (like we used |
In our project we are extending
SimpleElasticsearchPersistentEntity
to slightly modify the result ofgetIndexCoordinates()
method to add our custom logic for automatically assigning prefix to index name. That's the only modification, we want to use the rest ofSimpleElasticsearchPersistentEntity
as it is.But in #1788 a new inner class
ContextConfiguration
was added toSimpleElasticsearchPersistentEntity
with package-private access, which was also added as a parameter to constructor. This means thatSimpleElasticsearchPersistentEntity
can't be extended outside oforg.springframework.data.elasticsearch.core.mapping
package despite the fact thatSimpleElasticsearchPersistentEntity
itself ispublic
. That difference in access modifiers for class and its constructor parameter is a little bit misleading (and also broke our sub-class ;) )I would like to ask if
ContextConfiguration
could be made alsopublic
? Looking into the code it holds onlyFieldNamingStrategy
which is public and a boolean whether to save type hints into documents. Those are things that are set on mapping context and could be customised there anyway, so I think that it could be madepublic
to allow extending and instantiation ofSimpleElasticsearchPersistentEntity
possible again outside of its package. Or were there some important reasons forContextConfiguration
being package-private?The text was updated successfully, but these errors were encountered: