Serialize annotation values

25 views
Skip to first unread message

radhakris...@gmail.com

unread,
Dec 17, 2020, 1:11:21 AM12/17/20
to jackson-user
Hi,

I think this isn't common usage. Nothing is written. Should I decorate it with any annotation ?

objectMapper.writeValue( System.out, new Name(){
public Class<? extends Annotation> annotationType() {
return Annotation.class;
}

public String getInterface() {
return "interface";
}
});
}

public @interface Name{
String getInterface() default "interface";
}


Thanks.

Tatu Saloranta

unread,
Dec 19, 2020, 12:29:56 AM12/19/20
to jackson-user
What exactly are you trying to achieve here? I would expect that to produce output like

{"interface":"interface"}

with code like that; I would assume it gets treated like any POJO.

-+ Tatu +-

radhakris...@gmail.com

unread,
Jan 4, 2021, 4:05:53 AM1/4/21
to jackson-user
I don't have a design for code that needs this at this time and will report back when I have.

Mohan

Reply all
Reply to author
Forward
0 new messages