FasterXML / jackson-annotations

Core annotations (annotations that only depend on jackson-core) for Jackson data processor
https://github.com/FasterXML/jackson
Apache License 2.0
1.03k stars 330 forks source link

Add an annotation to indicate 'always use id' #4

Closed cowtowncoder closed 12 years ago

cowtowncoder commented 12 years ago

Current behavior for Object Id serialization is to serialize first instance normally, and then serialize all the other references as ids. This makes sense when data must be self-contained, i.e. fully deserializable without any external information.

However, there are cases where it would make sense to serialize ALL instances as just id; this makes sense if deserialization side knows how to map these ids externally to instances, without requiring them to be included in serialization.

cowtowncoder commented 12 years ago

Implemented by adding a new annotation:

'@JsonIdentityReference`

to be used on property. Created separate annotation so that basic identity info definition can be separate from details of how references are configured.