aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/equalparts/cardbase/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/eu/equalparts/cardbase/utils')
-rw-r--r--src/eu/equalparts/cardbase/utils/JSON.java41
-rw-r--r--src/eu/equalparts/cardbase/utils/MTGUniverse.java13
2 files changed, 7 insertions, 47 deletions
diff --git a/src/eu/equalparts/cardbase/utils/JSON.java b/src/eu/equalparts/cardbase/utils/JSON.java
deleted file mode 100644
index 4a21311..0000000
--- a/src/eu/equalparts/cardbase/utils/JSON.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package eu.equalparts.cardbase.utils;
-
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.MapperFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-/**
- * This class simply holds an {@code ObjectMapper} to be used whenever JSON must be parsed.
- * In the future it may be removed in favour of individual mappers for each function.
- *
- * @author Eduardo Pedroni
- */
-public final class JSON {
-
- /**
- * The Jackson {@code ObjectMapper} which parses fetched JSON files.
- */
- public static final ObjectMapper mapper = createMapper();
-
- /**
- * Private constructor, this class is not to be instantiated.
- */
- private JSON() {}
-
- /**
- * Instantiate and configure Jackson mapper statically.
- *
- * @return the {@code ObjectMapper}, ready to use.
- */
- private static ObjectMapper createMapper() {
- ObjectMapper objectMapper = new ObjectMapper();
- // classes don't necessarily use all json fields
- objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- // disable auto detection
- objectMapper.disable(MapperFeature.AUTO_DETECT_CREATORS,
- MapperFeature.AUTO_DETECT_FIELDS,
- MapperFeature.AUTO_DETECT_GETTERS,
- MapperFeature.AUTO_DETECT_IS_GETTERS);
- return objectMapper;
- }
-}
diff --git a/src/eu/equalparts/cardbase/utils/MTGUniverse.java b/src/eu/equalparts/cardbase/utils/MTGUniverse.java
index 6acb092..9412e6d 100644
--- a/src/eu/equalparts/cardbase/utils/MTGUniverse.java
+++ b/src/eu/equalparts/cardbase/utils/MTGUniverse.java
@@ -12,9 +12,10 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
-import eu.equalparts.cardbase.cards.Card;
-import eu.equalparts.cardbase.cards.CardSetInformation;
-import eu.equalparts.cardbase.cards.FullCardSet;
+import eu.equalparts.cardbase.card.Card;
+import eu.equalparts.cardbase.card.CardSetInformation;
+import eu.equalparts.cardbase.card.FullCardSet;
+import eu.equalparts.cardbase.json.JSON;
/**
* Access point to the complete set of cards that exist in the
@@ -202,9 +203,9 @@ public final class MTGUniverse {
Map<String, Card> cardMap = new HashMap<String, Card>();
for (Card card : rawList) {
// add set code for convenience
- card.setCode = setCode;
- card.imageCode = imageCode;
- cardMap.put(card.number, card);
+ card.setCode.set(setCode);
+ card.imageCode.set(imageCode);
+ cardMap.put(card.number.get(), card);
}
fcs.cards = cardMap;
} else {