I see no generic and clean way to handle this with json. I would recommend
the workaround with a custom `VPackDeserializer` for the self pointing
class. This doesn't need any additional information stored in the document.
public static class SelfPointingTestEntity {
private String foo;
private SelfPointingTestEntity self;
public SelfPointingTestEntity() {
super();
}
}
final ArangoDB.Builder builder = new ArangoDB.Builder().
registerDeserializer(SelfPointingTestEntity.class,
new VPackDeserializer<SelfPointingTestEntity>() {
@Override
public SelfPointingTestEntity deserialize(
final VPackSlice parent,
final VPackSlice vpack,
final VPackDeserializationContext context) throws VPackException {
final SelfPointingTestEntity entity = new SelfPointingTestEntity();
entity.foo = vpack.get("foo").getAsString();
entity.self = entity;
return entity;
}
});
Am Freitag, 31. März 2017 18:43:16 UTC+2 schrieb JPatrick Davenport:
>
> I need the field to point to itself. Java serialization gets around this
> issue by identifying the object in question. When it sees that object
> again, it knows to not serialize it, but use the instance it already has.
> I'm not sure how this could translate into a JSON based format.
>
--
You received this message because you are subscribed to the Google Groups
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.