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 a new `ObjectIdGenerator`, `StringIdGenerator`, to allow arbitrary `String` Object Id usage #77

Closed cowtowncoder closed 8 years ago

cowtowncoder commented 8 years ago

(note: based on idea from https://github.com/FasterXML/jackson-dataformat-yaml/issues/45)

There is one possibly common use case with Object Ids: one where no generation is needed, but source ids are String ids with arbitrary structure (or, possibly, none) and where the only important thing from Jackson perspective is that they are unique ids.

In addition to allow use of "opaque" Object Ids, generation side could either:

  1. Throw an exception if attempted, to only for deserialization, OR
  2. Use Random UUID generation, similar to UUIDGenerator

For now I think (2) makes more sense, as it actually will work just fine. If anyone wants to disallow this, or change it, they may then simply override implementation method(s).