Class ExtensibleJsonPojo

java.lang.Object
tenapull.data.entity.template.ExtensibleJsonPojo
Direct Known Subclasses:
GeneratedIdPojo, NaturalIdPojo

@MappedSuperclass
public abstract class ExtensibleJsonPojo
extends java.lang.Object
Abstract base class that implements ExtraJson behavior for most pojos other than string lookups. Note that 'implements DbPojo' interface is delayed until NaturalIdPojo and GeneratedIdPojo, because they have different requirement for how to implement id.
  • Constructor Summary

    Constructors 
    Constructor Description
    ExtensibleJsonPojo()  
  • Method Summary

    Modifier and Type Method Description
    protected void __prepare()
    Convienence method for subclass implementations to invoke from their _prepare() method (note the difference in number of underscores), which performs DB preparations on the ExtraJson
    ExtraJson getExtraJson()
    Gets extra json.
    com.fasterxml.jackson.databind.JsonNode getExtraJson​(java.lang.String key)
    Gets extra json for a specific key
    java.util.Map<java.lang.String,​com.fasterxml.jackson.databind.JsonNode> getExtraJsonMap()
    Gets extra json map for serialization
    void putExtraJson​(java.lang.String key, java.lang.Object value)
    Puts extra json during deserialization
    void setExtraJson​(ExtraJson extraJson)
    Sets entire extra json value.
    com.fasterxml.jackson.databind.node.ObjectNode toJsonNode()
    Converts the pojo into a serialized JSON ObjectNode
    java.lang.String toJsonString()
    Serializes the pojo into a JSON string
    java.lang.String toString()
    Uses the toJsonString() method to convert to a JSON string, except catches any JsonProcessingException and returns an error message instead

    Methods inherited from class java.lang.Object

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

  • Method Details

    • getExtraJson

      public ExtraJson getExtraJson()
      Gets extra json.
      Returns:
      the extra json
    • setExtraJson

      public void setExtraJson​(ExtraJson extraJson)
      Sets entire extra json value.
      Parameters:
      extraJson - the extra json
    • getExtraJsonMap

      public java.util.Map<java.lang.String,​com.fasterxml.jackson.databind.JsonNode> getExtraJsonMap()
      Gets extra json map for serialization
      Returns:
      the extra json map
    • putExtraJson

      public void putExtraJson​(java.lang.String key, java.lang.Object value)
      Puts extra json during deserialization
      Parameters:
      key - the key
      value - the value
    • getExtraJson

      public com.fasterxml.jackson.databind.JsonNode getExtraJson​(java.lang.String key)
      Gets extra json for a specific key
      Parameters:
      key - the key
      Returns:
      the extra json
    • __prepare

      protected void __prepare()
      Convienence method for subclass implementations to invoke from their _prepare() method (note the difference in number of underscores), which performs DB preparations on the ExtraJson
    • toJsonNode

      public com.fasterxml.jackson.databind.node.ObjectNode toJsonNode()
      Converts the pojo into a serialized JSON ObjectNode
      Returns:
      the object node
    • toJsonString

      public java.lang.String toJsonString() throws com.fasterxml.jackson.core.JsonProcessingException
      Serializes the pojo into a JSON string
      Returns:
      the JSON string
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException - if there is json processing exception
    • toString

      public java.lang.String toString()
      Uses the toJsonString() method to convert to a JSON string, except catches any JsonProcessingException and returns an error message instead
      Overrides:
      toString in class java.lang.Object
      Returns:
      the serialized JSON string, or an error message if serialization failed