// Path: stardao-core/src/main/java/io/stardog/stardao/jackson/UpdateDeserializer.java
// public class UpdateDeserializer extends JsonDeserializer<Update<?>> implements ContextualDeserializer {
//     private JavaType valueType;
// 
//     @Override
//     public JsonDeserializer<?> createContextual(DeserializationContext ctx, BeanProperty property) throws JsonMappingException {
//         JavaType wrapperType = (property == null) ? ctx.getContextualType() : property.getType();
//         JavaType valueType = wrapperType.containedType(0);
// 
//         UpdateDeserializer deserializer = new UpdateDeserializer();
//         deserializer.valueType = valueType;
//         return deserializer;
//     }
// 
//     @Override
//     public Update<?> deserialize(JsonParser parser, DeserializationContext ctx) throws IOException {
//         ObjectMapper mapper = (ObjectMapper) parser.getCodec();
// 
//         JsonNode node = mapper.readTree(parser);
// 
//         ImmutableSet.Builder<String> setFields = ImmutableSet.builder();
//         ImmutableSet.Builder<String> removeFields = ImmutableSet.builder();
//         Map<String,JsonNode> setNodes = new HashMap<>();
// 
//         Iterator<String> iter = node.fieldNames();
//         while (iter.hasNext()) {
//             String field = iter.next();
//             JsonNode value = node.get(field);
//             if (value instanceof NullNode) {
//                 removeFields.add(field);
//             } else if (value instanceof TextNode && value.toString().equals("\"\"")) {
//                 removeFields.add(field);
//             } else {
//                 setFields.add(field);
//                 setNodes.put(field, value);
//             }
//         }
//         Object setObject = mapper.convertValue(setNodes, valueType);
// 
//         return Update.of(setObject, setFields.build(), removeFields.build());
//     }
// }
// 
// Path: stardao-core/src/main/java/io/stardog/stardao/jackson/UpdateSerializer.java
// public class UpdateSerializer extends JsonSerializer<Update<?>> {
//     @Override
//     public void serialize(Update<?> update, JsonGenerator jsonGen, SerializerProvider serializerProvider) throws IOException {
//         ObjectMapper mapper = (ObjectMapper) jsonGen.getCodec();
//         Map<String,Object> partial = mapper.convertValue(update.getPartial(), new TypeReference<Map<String,Object>>() { });
// 
//         jsonGen.writeStartObject();
//         for (String field : update.getSetFields()) {
//             jsonGen.writeObjectField(field, partial.get(field));
//         }
//         for (String field : update.getRemoveFields()) {
//             jsonGen.writeNullField(field);
//         }
// 
//         jsonGen.writeEndObject();
//     }
// }


import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import io.stardog.stardao.jackson.UpdateDeserializer;
import io.stardog.stardao.jackson.UpdateSerializer;
import java.util.Set;
package io.stardog.stardao.core;



@AutoValue
@JsonDeserialize(using = UpdateDeserializer.class)
// Path: stardao-core/src/main/java/io/stardog/stardao/jackson/UpdateDeserializer.java
// public class UpdateDeserializer extends JsonDeserializer<Update<?>> implements ContextualDeserializer {
//     private JavaType valueType;
// 
//     @Override
//     public JsonDeserializer<?> createContextual(DeserializationContext ctx, BeanProperty property) throws JsonMappingException {
//         JavaType wrapperType = (property == null) ? ctx.getContextualType() : property.getType();
//         JavaType valueType = wrapperType.containedType(0);
// 
//         UpdateDeserializer deserializer = new UpdateDeserializer();
//         deserializer.valueType = valueType;
//         return deserializer;
//     }
// 
//     @Override
//     public Update<?> deserialize(JsonParser parser, DeserializationContext ctx) throws IOException {
//         ObjectMapper mapper = (ObjectMapper) parser.getCodec();
// 
//         JsonNode node = mapper.readTree(parser);
// 
//         ImmutableSet.Builder<String> setFields = ImmutableSet.builder();
//         ImmutableSet.Builder<String> removeFields = ImmutableSet.builder();
//         Map<String,JsonNode> setNodes = new HashMap<>();
// 
//         Iterator<String> iter = node.fieldNames();
//         while (iter.hasNext()) {
//             String field = iter.next();
//             JsonNode value = node.get(field);
//             if (value instanceof NullNode) {
//                 removeFields.add(field);
//             } else if (value instanceof TextNode && value.toString().equals("\"\"")) {
//                 removeFields.add(field);
//             } else {
//                 setFields.add(field);
//                 setNodes.put(field, value);
//             }
//         }
//         Object setObject = mapper.convertValue(setNodes, valueType);
// 
//         return Update.of(setObject, setFields.build(), removeFields.build());
//     }
// }
// 
// Path: stardao-core/src/main/java/io/stardog/stardao/jackson/UpdateSerializer.java
// public class UpdateSerializer extends JsonSerializer<Update<?>> {
//     @Override
//     public void serialize(Update<?> update, JsonGenerator jsonGen, SerializerProvider serializerProvider) throws IOException {
//         ObjectMapper mapper = (ObjectMapper) jsonGen.getCodec();
//         Map<String,Object> partial = mapper.convertValue(update.getPartial(), new TypeReference<Map<String,Object>>() { });
// 
//         jsonGen.writeStartObject();
//         for (String field : update.getSetFields()) {
//             jsonGen.writeObjectField(field, partial.get(field));
//         }
//         for (String field : update.getRemoveFields()) {
//             jsonGen.writeNullField(field);
//         }
// 
//         jsonGen.writeEndObject();
//     }
// }


// Path: stardao-core/src/main/java/io/stardog/stardao/core/Update.java
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import io.stardog.stardao.jackson.UpdateDeserializer;
import io.stardog.stardao.jackson.UpdateSerializer;
import java.util.Set;

package io.stardog.stardao.core;



@AutoValue
@JsonDeserialize(using = UpdateDeserializer.class)
@JsonSerialize(using = UpdateSerializer.class)