/** */ @Override public Ref deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { if (jp.getCurrentToken() != JsonToken.VALUE_STRING) throw new IllegalStateException("Cannot yet deserialize Refs that were serialized to a full entity object (as opposed to just string key representation)"); String text = jp.getText(); return Ref.create(Key.create(text)); } }
/** Creates a Ref from a registered pojo entity */ public static <T> Ref<T> create(T value) { Key<T> key = Key.create(value); return create(key); }
public static <T> Ref<T> ref(T instance) { return instance == null ? null : Ref.create(instance); }
public static <T> Ref<T> ref(Key<T> key) { return key == null ? null : Ref.create(key); }