Skip to content

Re-hydration from previous state #73

Description

@pocesar

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.

Activity

  1. fieldju commented on Feb 4, 2020

    @fieldju
    Member

    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.

  2. pocesar commented on Feb 4, 2020

    @pocesar
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions