io.quarkus.rest.client.reactive.jackson.ClientObjectMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-rest-client-jackson Show documentation
Show all versions of quarkus-rest-client-jackson Show documentation
Jackson serialization support for REST Client
The newest version!
package io.quarkus.rest.client.reactive.jackson;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Used to easily define a custom object mapper for the specific REST Client on which it's used.
*
* The annotation MUST be placed on a method of the REST Client interface that meets the following criteria:
*
* - Is a {@code static} method
*
*
* An example method could look like the following:
*
*
* {@code
* @ClientObjectMapper
* static ObjectMapper objectMapper() {
* return new ObjectMapper();
* }
*
* }
*
*
* Moreover, we can inject the default ObjectMapper instance to create a copy of it by doing:
*
*
* {@code
* @ClientObjectMapper
* static ObjectMapper objectMapper(ObjectMapper defaultObjectMapper) {
* return defaultObjectMapper.copy() <3>
* .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
* .disable(DeserializationFeature.UNWRAP_ROOT_VALUE);
* }
*
* }
*
*
* Remember that the default object mapper instance should NEVER be modified, but instead always use copy if they pan to
* inherit the default settings.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ClientObjectMapper {
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy