From afe7f810655d458130cd0eadfd6243c63106a0c1 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Wed, 10 Aug 2016 01:42:34 +0800 Subject: [PATCH] Simplify json xattr metadata --- source/net/filebot/media/MetaAttributes.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/source/net/filebot/media/MetaAttributes.java b/source/net/filebot/media/MetaAttributes.java index 49dbfcd6..3219056c 100644 --- a/source/net/filebot/media/MetaAttributes.java +++ b/source/net/filebot/media/MetaAttributes.java @@ -57,7 +57,7 @@ public class MetaAttributes { public void setObject(Object object) { try { - metaAttributeView.put(METADATA_KEY, JsonWriter.objectToJson(object, jsonOptions)); + metaAttributeView.put(METADATA_KEY, JsonWriter.objectToJson(object, getJsonOptions())); } catch (Exception e) { throw new RuntimeException(e); } @@ -67,7 +67,7 @@ public class MetaAttributes { try { String jsonObject = metaAttributeView.get(METADATA_KEY); if (jsonObject != null && jsonObject.length() > 0) { - return JsonReader.jsonToJava(jsonObject, jsonOptions); + return JsonReader.jsonToJava(jsonObject, getJsonOptions()); } } catch (Exception e) { throw new RuntimeException(e); @@ -80,13 +80,8 @@ public class MetaAttributes { metaAttributeView.put(METADATA_KEY, null); } - private static final Map jsonOptions = getJsonOptions(); - - private static Map getJsonOptions() { - Map opts = new HashMap(2); - opts.put(JsonWriter.TYPE_NAME_MAP, Stream.of(Episode.class, Movie.class, MoviePart.class, AudioTrack.class, SeriesInfo.class, SimpleDate.class).collect(toMap(Class::getName, Class::getSimpleName))); - opts.put(JsonWriter.SKIP_NULL_FIELDS, true); - return opts; + public Map getJsonOptions() { + return null; } }