Class ExtraJson.JsonMap

java.lang.Object
tenapull.data.entity.objectLookup.ExtraJson.JsonMap
Enclosing class:
ExtraJson

public static class ExtraJson.JsonMap
extends java.lang.Object
A wrapper for the map representing the key-value pairs of the ExtraJson. Hibernate is not able to directly process a Map, but by wrapping it I am able to use a converter to convert between the DB and the ORM
  • Constructor Summary

    Constructors 
    Constructor Description
    JsonMap()
    Instantiates a new empty JsonMap
    JsonMap​(java.lang.String jsonStr)
    Instantiates a new Json map by deserializing the provided string
    JsonMap​(java.util.Map<java.lang.String,​com.fasterxml.jackson.databind.JsonNode> map)
    Instantiates a new JsonMap, copying the provided map
  • Method Summary

    Modifier and Type Method Description
    boolean equals​(java.lang.Object o)  
    Hash get_hash()
    Calculates the hash of the JsonMap if it is not already calculated, or returns the pre-calculated hash if it was calculated.
    java.util.Map<java.lang.String,​com.fasterxml.jackson.databind.JsonNode> getView()
    Gets the immutable view of the map
    int hashCode()  
    java.util.Map<java.lang.String,​com.fasterxml.jackson.databind.JsonNode> makeCopy()
    Returns a mutable copy of the map
    void set_hash​(Hash hash)
    Sets the hash after performing an immutability check
    java.lang.String toString()
    Serializes the map into a string

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • JsonMap

      public JsonMap()
      Instantiates a new empty JsonMap
    • JsonMap

      public JsonMap​(java.util.Map<java.lang.String,​com.fasterxml.jackson.databind.JsonNode> map)
      Instantiates a new JsonMap, copying the provided map
      Parameters:
      map - the map
    • JsonMap

      public JsonMap​(java.lang.String jsonStr) throws com.fasterxml.jackson.core.JsonProcessingException, java.lang.IllegalArgumentException
      Instantiates a new Json map by deserializing the provided string
      Parameters:
      jsonStr - the json string to deserialize
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException - if there was an exception while deserializing
      java.lang.IllegalArgumentException - if the deserialized JsonNode is not an ObjectNode
  • Method Details

    • getView

      public java.util.Map<java.lang.String,​com.fasterxml.jackson.databind.JsonNode> getView()
      Gets the immutable view of the map
      Returns:
      the view
    • makeCopy

      public java.util.Map<java.lang.String,​com.fasterxml.jackson.databind.JsonNode> makeCopy()
      Returns a mutable copy of the map
      Returns:
      the map
    • toString

      public java.lang.String toString()
      Serializes the map into a string
      Overrides:
      toString in class java.lang.Object
      Returns:
    • equals

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class java.lang.Object
    • get_hash

      public Hash get_hash()
      Calculates the hash of the JsonMap if it is not already calculated, or returns the pre-calculated hash if it was calculated.
      Returns:
      the SHA-512 hash of the serialized map
    • set_hash

      public void set_hash​(Hash hash) throws java.lang.IllegalStateException
      Sets the hash after performing an immutability check
      Parameters:
      hash - the hash to set
      Throws:
      java.lang.IllegalStateException - if the hash is being changed to a value different than previously set. All values including the hash are intended to be immutable once a lookup record is created
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object