Class InventoryMapper


  • public class InventoryMapper
    extends Object
    Wrapper around Jackson's ObjectMapper for serializing and deserializing Inventories. The ObjectMapper setup is a finicky and I do not recommend changing it unless you are sure you know what you're doing.
    • Constructor Detail

      • InventoryMapper

        public InventoryMapper​(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
        Should use InventoryMapper.defaultMapper() or InventoryMapper.prettyPrintMapper() unless you know what you're doing.
        Parameters:
        objectMapper - object mapper
    • Method Detail

      • prettyPrintMapper

        public static InventoryMapper prettyPrintMapper()
        Creates an InventoryMapper that will pretty print JSON files. This should be used when you value human readability over disk space usage.
        Returns:
        mapper
      • defaultMapper

        public static InventoryMapper defaultMapper()
        Creates an InventoryMapper that creates JSON files with as little whitespace as possible. This should be used when minimizing disk space usage is more important than human readability.
        Returns:
        mapper
      • write

        public void write​(Path destination,
                          Inventory inventory)