Github user meiercaleb commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/137#discussion_r97369470
--- Diff:
common/rya.api/src/main/java/org/apache/rya/api/domain/StatementMetadata.java
---
@@ -19,36 +19,50 @@
package org.apache.rya.api.domain;
import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;
import org.apache.rya.api.persist.RdfDAOException;
+import org.openrdf.model.impl.URIImpl;
+import com.google.common.base.Preconditions;
+import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonDeserializationContext;
+import com.google.gson.JsonDeserializer;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParseException;
+import com.google.gson.JsonPrimitive;
+import com.google.gson.JsonSerializationContext;
+import com.google.gson.JsonSerializer;
public class StatementMetadata {
-
- private static Gson gson = new Gson();
+
+ private static Gson gson;
public static StatementMetadata EMPTY_METADATA = new
StatementMetadata();
-
- private Map<String, String> metadataMap = new HashMap<String,
String>();
-
+
+ private Map<RyaURI, RyaType> metadataMap = new HashMap<>();
+ @SuppressWarnings("serial")
+ private Type type = new TypeToken<Map<RyaURI, RyaType>>(){}.getType();
+
public StatementMetadata() {
-
- }
-
- public void addMetadata(String key, String value){
- metadataMap.put(key, value);
+ gson = new GsonBuilder().enableComplexMapKeySerialization()
--- End diff --
Nope. Good catch. You're right.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---