On Sun, Apr 23, 2023 at 11:12 AM Olive Ahn <ssibon...@gmail.com> wrote:
>
> I created a CustomSerializer for String class, is there a way to apply this 
> to a specific class only?
>
>  ex.
>
> class Response<T> {
>
>   private T result;
>
> }
>
>
> class DefaultResponse<T> {
>
>   private T result;
>
> }
>
>
> When there is, I want to apply that Serializer only to DefaultResponse.

I am not 100% sure I understand the question here, given reference to
`String` type, but use of type-variable T.

But if we assume `T` would be bound to `String` for usage, the only
way I know to indicate usage within certain type is to use annotation

@JsonSerialize(using = MySerializer.class)
private T result;

and not registering serializers globally. Global serializers are
assigned only based on specific type of value, but not containment
(Value of type T within type C).

-+ Tatu +-

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jackson-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jackson-user/CAL4a10gR4DSi%3DvDp89xgx334P2QwuLRdaitA7GTKD6Jq4ZeG2Q%40mail.gmail.com.

Reply via email to