Skip to content
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

Add support for private properties. #482

Merged
merged 1 commit into from Nov 19, 2020

Conversation

willson556
Copy link
Contributor

Motivation: It can be necessary to serialize and deserialize internal (or more private) properties in order to restore object state. It is desirable to restrict access to these properties to encapsulate functionality.

Extend the ReadablePropertiesTypeInspector to handle non-public properties.

While it is possible for the user to provide custom type inspectors, it's not easy for these to surface additional properties. An alternative approach to the work here would be to make ReflectionPropertyDescriptor protected and unseal ReadablePropertiesTypeInspector. The BuilderSkeletonwould also need to allow the rootITypeInspector`(s) to be customized.

This approach surfaces the non-public properties while leaving any more complex filtering (such as only serializing them if they have an extra attribute) to downstream type inspectors.

Extend the `ReadablePropertiesTypeInspector` to handle non-public
properties.

While it is possible for the user to provide custom type inspectors,
it's not easy for these to surface additional properties. An alternative
approach to the work here would be to make
`ReflectionPropertyDescriptor` protected and unseal
`ReadablePropertiesTypeInspector`. The `BuilderSkeleton` would also need to
allow the root `ITypeInspector`(s) to be customized.
@aaubry
Copy link
Owner

aaubry commented Nov 19, 2020

I'm sorry it took so long to review this PR, but thanks anyway!

@aaubry aaubry merged commit 5833470 into aaubry:master Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants