* if we set it for regular types, jackson will build the serializer based on this type, and not the
* instance type, making polymorphic returns broken.
* For parameterized types it helps Jackson which otherwise tries to guess the serializer based on
* value.getClass() which doesn't return type parameters information due to Java erasure.
*/
writer = writer.withType(TypeFactory.defaultInstance().constructType(valueType));
}
return Optional.of(JsonEntityResponseWriter.<T>using(valueType, writer));
}
};
}