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

System for not writing fields with default values to file #30

Open
tlaundal opened this issue Nov 23, 2017 · 2 comments
Open

System for not writing fields with default values to file #30

tlaundal opened this issue Nov 23, 2017 · 2 comments

Comments

@tlaundal
Copy link
Member

I've come in quite a few cases where I wish only the fields that differ from the default value in the class is saved.

For instance, if I have a section that has a type property, and some fields are only relevant to one type, or if I just have a lot of fields, and the default values will be fine for many of them in most cases.

It should still be possible to force some fields to be saved, but that could be done with an annotation. Or we could go the other way and annotate fields that only should be hidden if they have the default value.

@Faithcaio
Copy link
Member

While it might not do everything you described, we already have a system to hide defaults:
Reflected#setDefault
I cannot remember if you can directly call addInheritedField & removeInheritedField directly too.

@tlaundal
Copy link
Member Author

Can those defaults be used in custom converters? Or in MapNode?

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

No branches or pull requests

2 participants