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

Made Gson static to avoid creating it for each (de)serialization requ… #169

Merged
merged 1 commit into from
Feb 26, 2022

Conversation

dimaa6
Copy link

@dimaa6 dimaa6 commented Jan 11, 2022

…est #168

Copy link
Member

@TVolden TVolden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Comment on lines +98 to +102
static {
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(ZonedDateTime.class, new ZonedDateTimeSerializer());
gson = builder.create();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never seen this before, I had to look it up. It's called static block and it runs while the class loader runs, before main is called. Interesting.

@TVolden
Copy link
Member

TVolden commented Feb 26, 2022

Thanks for your contribution and sorry for my slow response time. It's now merged and the maven check was green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants