/** * For collections of Primitives or Values it's simply an added (or removed) item.<br/> * For collections of Entities or ValueObjects * it's a {@link GlobalId} reference to an added (or removed) item. */ public Object getValue() { return value.unwrap(); }
/** * Added item. See {@link #getValue()} javadoc */ public Object getAddedValue() { return value.unwrap(); }
/** * Removed item. See {@link #getValue()} javadoc */ public Object getRemovedValue() { return value.unwrap(); }
public Object getKey() { return key.unwrap(); }
public Object getRightValue() { return rightValue.unwrap(); }
public Object getValue() { return value.unwrap(); }
public Object getLeftValue() { return leftValue.unwrap(); }
public Object getRightValue() { return rightValue.unwrap(); }
public Object getLeftValue() { return leftValue.unwrap(); }
public Object getLeft() { return left.unwrap(); }
public Object getRight() { return right.unwrap(); }
private JsonElement wrapTypeSafely(Atomic sourceValue, JsonSerializationContext jsonSerializationContext){ JsonObject element = new JsonObject(); element.addProperty("typeAlias", sourceValue.unwrap().getClass().getSimpleName()); element.add("value" , jsonSerializationContext.serialize(sourceValue.unwrap())); return element; }
@Override public JsonElement toJson(Atomic sourceValue, JsonSerializationContext jsonSerializationContext) { if (sourceValue.isNull()) { return JsonNull.INSTANCE; } JsonElement rawValue = jsonSerializationContext.serialize(sourceValue.unwrap()); if (sourceValue.isJsonBasicType()|| !typeSafety){ return rawValue; } return wrapTypeSafely(sourceValue, jsonSerializationContext); }