Annotation Interface CustomSerialization


@Experimental("Remains to be determined if this is the best possible API for users to configure per Resource Method Serialization") @Retention(RUNTIME) @Target({METHOD,TYPE}) public @interface CustomSerialization
Annotation that can be used on RESTEasy Reactive Resource method to allow users to configure Jackson serialization for that method only, without affecting the global Jackson configuration.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Class<? extends BiFunction<com.fasterxml.jackson.databind.ObjectMapper,Type,com.fasterxml.jackson.databind.ObjectWriter>>
    A BiFunction that converts the global ObjectMapper and type for which a custom ObjectWriter is needed (this type will be a generic type if the method returns such a generic type) and returns the instance of the custom ObjectWriter.
  • Element Details

    • value

      Class<? extends BiFunction<com.fasterxml.jackson.databind.ObjectMapper,Type,com.fasterxml.jackson.databind.ObjectWriter>> value
      A BiFunction that converts the global ObjectMapper and type for which a custom ObjectWriter is needed (this type will be a generic type if the method returns such a generic type) and returns the instance of the custom ObjectWriter.

      Quarkus will construct one instance of this BiFunction for each JAX-RS resource method that is annotated with CustomSerialization and once an instance is created it will be cached for subsequent usage by that resource method.

      The BiFunction MUST contain a no-args constructor.

      Furthermore, it is advisable that it contains no state that is updated outside its constructor.

      Finally and most importantly, the ObjectMapper should NEVER be changed any way as it is the global ObjectMapper that is accessible to the entire Quarkus application.