Class<?> raw = type.getRawClass();
if (Optional.class.isAssignableFrom(raw)){
return new GuavaOptionalSerializer(type);
}
if (Range.class.isAssignableFrom(raw)) {
return new RangeSerializer(type);
}
// since 2.4
if (HostAndPort.class.isAssignableFrom(raw)) {
return ToStringSerializer.instance;
}