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

Re-hydration from previous state #73

Open
pocesar opened this issue Feb 4, 2020 · 2 comments
Open

Re-hydration from previous state #73

pocesar opened this issue Feb 4, 2020 · 2 comments

Comments

@pocesar
Copy link

pocesar commented Feb 4, 2020

Right now, I'm accessing the "private" members directly, and assigning them manually. would be good to have an static method, like fromJSON(theOneReturnedFromtoJSON) to initialize the classes using a previous state.

@fieldju
Copy link
Member

fieldju commented Feb 4, 2020

This sounds reasonable. I really dislike the method name toJson that all the metrics impl, because some of them do NOT return JSON, should really be getValue() or getPayload().

Since this lib is inspired from Dropwizard see: https://github.com/dropwizard/metrics/blob/4.1-development/metrics-core/src/main/java/com/codahale/metrics/Gauge.java#L25

So maybe the static initializer could be fromValue.

@pocesar
Copy link
Author

pocesar commented Feb 4, 2020

recreating the internal representation is harder than I expected, there are too many moving parts (new class instances, and their internals as well)

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