Introspecting private fields without getters
Closed this issue · 6 comments
In 0.13.1 release is there a way to configure ObjectDiffer to introspect private fields that don't have corresponding getters? What about 0.9.0 release?
Thanks
Unfortunately there is no way to do this with any of the released versions. However, the current master branch contains a completely rewritten version of the library which allows to create and use your own introspector implementations. That part of the the rewritten version is already tested and works like intended. I think that the current codebase provides everything needed to implement an introspector that is capable of looking at private fields, but I haven't tried it yet.
I don't think I'll get to it anytime soon, so I would be happy to see you give it a try and write your own implementation. I think doing so will involve writing your own Introspector, PropertyAwareAccessor and (probably) ElementSelector implementations. The accessor needs to be capable to read and write the fields (even when they are private or final). When you put this all together all you need to do is to change the default introspector to your own implementation. Here is an example how to do this.
Hope this helps! Feel free to ask me anything if you give it a try and run into any problems.
We don't normally include 3rd-party SNAPSHOT builds as dependencies. I might be able to find some time to work on this if you are planning to kick off a RELEASE build soon. Any thoughts on the timing of that release and when it will be available in the Maven repo?
I'm getting close to a point where I think the API will remain stable for a while. I might be able to release the new version this weekend. Probably marked as RC1 or M1 but at least officially released and available via Maven Central.
I will look forward to the official Maven release. Thanks!
On Wed, May 7, 2014 at 4:13 PM, Daniel Bechler notifications@github.comwrote:
I'm getting close to a point where I think the API will remain stable for
a while. I might be able to release the new version this weekend. Probably
marked as RC1 or M1 but at least officially released and available via
Maven Central.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/92#issuecomment-42490246
.
I just pushed version 0.90.RC1 to Maven Central. I didn't find the time to write any release notes yet, but I hope the API is self-explanatory enough for now.
I pushed the final 0.90 release yesterday, so it is now officially the new master branch. I'll create a new feature request issue regarding a different Introspector that can access private fields.