jackson-module-scala icon indicating copy to clipboard operation
jackson-module-scala copied to clipboard

Examine MixIn annotation support for trait fields

Open christophercurrie opened this issue 12 years ago • 1 comments

As discussed in #77, it would be helpful if there were a way to ignore all the implemented fields and methods of a trait used by a class.

christophercurrie avatar May 11 '13 19:05 christophercurrie

Adding my $0.02. Salat has a very useful ability for traits where it supplies a type hint in the generated JSON when serializing a class for a trait-type. So, for example:

@someAnnotationHere trait X case class Y( val a:String )

case class Target( foo: X ) val t = Target( Y("wow") )

When serializing t you would get something like: {"foo":{"_th":"com.something.Y","a":"wow"}}

The type hint would then be used during deserialization, because of course you'd have no other way to know that the 'X' type is actually a Y and not a Z or something else.

gzoller avatar Jun 10 '13 19:06 gzoller