-
Notifications
You must be signed in to change notification settings - Fork 54
Closed
Milestone
Description
HostAndPortDeserializer
should use field name host
instead of hostText
jackson-datatypes-collections:guava
@Override
public HostAndPort deserialize(JsonParser p, DeserializationContext ctxt)
throws IOException
{
// Need to override this method, which otherwise would work just fine,
// since we have legacy JSON Object format to support too:
if (p.currentToken() == JsonToken.START_OBJECT) { // old style
JsonNode root = p.readValueAsTree();
String host = root.path("hostText").asText();
JsonNode n = root.get("port");
if (n == null) {
return HostAndPort.fromString(host);
}
return HostAndPort.fromParts(host, n.asInt());
}
return super.deserialize(p, ctxt);
}
Guava
/**
* Returns the portion of this {@code HostAndPort} instance that should represent the hostname or
* IPv4/IPv6 literal.
*
* <p>A successful parse does not imply any degree of sanity in this field. For additional
* validation, see the {@link HostSpecifier} class.
*
* @since 20.0 (since 10.0 as {@code getHostText})
*/
public String getHost() {
return host;
}
Metadata
Metadata
Assignees
Labels
No labels