Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,15 @@ protected void autoMarshalEligible(Object o, JsonGenerator jgen) {
public static class InstanceInfoDeserializer extends JsonDeserializer<InstanceInfo> {
private static char[] BUF_AT_CLASS = "@class".toCharArray();

/** Extract uppercase from current JsonParser cursor. Avoids lambda capture. */
private static String toUpperCase(JsonParser jp) {
try {
return jp.getText().toUpperCase();
} catch (IOException e) {
throw new RuntimeJsonMappingException(e.getMessage());
}
}

enum InstanceInfoField {
HOSTNAME(ELEM_HOST),
INSTANCE_ID(ELEM_INSTANCE_ID),
Expand Down Expand Up @@ -515,14 +524,7 @@ public InstanceInfo deserialize(JsonParser jp, DeserializationContext context) t
break;
case APP:
builder.setAppNameForDeser(
intern.apply(jp, CacheScope.APPLICATION_SCOPE,
()->{
try {
return jp.getText().toUpperCase();
} catch (IOException e) {
throw new RuntimeJsonMappingException(e.getMessage());
}
}));
intern.apply(jp, CacheScope.APPLICATION_SCOPE, InstanceInfoDeserializer::toUpperCase));
break;
case IP:
builder.setIPAddr(intern.apply(jp));
Expand Down Expand Up @@ -590,14 +592,8 @@ public InstanceInfo deserialize(JsonParser jp, DeserializationContext context) t
builder.setHealthCheckUrlsForDeser(null, intern.apply(jp.getText()));
break;
case APPGROUPNAME:
builder.setAppGroupNameForDeser(intern.apply(jp, CacheScope.GLOBAL_SCOPE,
()->{
try {
return jp.getText().toUpperCase();
} catch (IOException e) {
throw new RuntimeJsonMappingException(e.getMessage());
}
}));
builder.setAppGroupNameForDeser(
intern.apply(jp, CacheScope.GLOBAL_SCOPE, InstanceInfoDeserializer::toUpperCase));
break;
case HOMEPAGEURL:
builder.setHomePageUrlForDeser(intern.apply(jp.getText()));
Expand Down
Loading