Class JsonDocument

java.lang.Object
io.stargate.sdk.data.domain.odm.Document<Map<String,Object>>
io.stargate.sdk.data.domain.JsonDocument

public class JsonDocument extends Document<Map<String,Object>>
Represents a document without schema contraints as a Map<String, Object>.(key/value)
  • Constructor Details

    • JsonDocument

      public JsonDocument()
      Default Constructor.
    • JsonDocument

      public JsonDocument(String json)
      Public constructor.
      Parameters:
      json - json structure
    • JsonDocument

      public JsonDocument(Map<String,Object> keyValue)
      Public constructor.
      Parameters:
      keyValue - key value for the Json
  • Method Details

    • id

      public JsonDocument id(String id)
      Fluent getter for document.
      Overrides:
      id in class Document<Map<String,Object>>
      Parameters:
      id - id
      Returns:
      self reference
    • vector

      public JsonDocument vector(float[] vector)
      Fluent getter for document.
      Overrides:
      vector in class Document<Map<String,Object>>
      Parameters:
      vector - vector
      Returns:
      self reference
    • data

      public JsonDocument data(Map<String,Object> data)
      Fluent getter for document.
      Overrides:
      data in class Document<Map<String,Object>>
      Parameters:
      data - data
      Returns:
      self reference
    • data

      public JsonDocument data(String json)
      Fluent getter for document.
      Parameters:
      json - json
      Returns:
      self reference
    • put

      public JsonDocument put(String key, Object value)
      Populate attribute
      Parameters:
      key - attribute name
      value - attribute value
      Returns:
      self reference
    • getList

      public <K> List<K> getList(String k, Class<K> itemClass)
      Return a List of items.
      Type Parameters:
      K - type of item
      Parameters:
      k - key
      itemClass - expected class
      Returns:
      list of items
    • getArray

      public <K> K[] getArray(String k, Class<K> itemClass)
      Return an Array of items.
      Type Parameters:
      K - type of item
      Parameters:
      k - key
      itemClass - expected class
      Returns:
      list of items
    • getObject

      public <T> T getObject(String k, Class<T> type)
      Access element from the map.
      Type Parameters:
      T - type of parameters
      Parameters:
      k - current configuration key
      type - type of elements
      Returns:
      configuration value
    • getString

      public String getString(String k)
      Access element from the map.
      Parameters:
      k - current configuration key
      Returns:
      configuration value
    • getDouble

      public Double getDouble(String k)
      Access element from the map
      Parameters:
      k - current configuration key
      Returns:
      configuration value
    • getInteger

      public Integer getInteger(String k)
      Access element from the map
      Parameters:
      k - current configuration key
      Returns:
      configuration value
    • getBoolean

      public Boolean getBoolean(String k)
      Access element from the map
      Parameters:
      k - current configuration key
      Returns:
      configuration value
    • getUUID

      public UUID getUUID(String k)
      Access element from the map
      Parameters:
      k - current configuration key
      Returns:
      configuration value
    • getFloat

      public Float getFloat(String k)
      Access element from the map
      Parameters:
      k - current configuration key
      Returns:
      configuration value
    • getLong

      public Long getLong(String k)
      Access element from the map
      Parameters:
      k - current configuration key
      Returns:
      configuration value
    • getShort

      public Short getShort(String k)
      Access element from the map
      Parameters:
      k - current configuration key
      Returns:
      configuration value
    • getByte

      public Byte getByte(String k)
      Access element from the map
      Parameters:
      k - current configuration key
      Returns:
      configuration value
    • getCharacter

      public Character getCharacter(String k)
      Access element from the map
      Parameters:
      k - current configuration key
      Returns:
      configuration value
    • getDate

      public Date getDate(String k)
      Access element from the map
      Parameters:
      k - current configuration key
      Returns:
      configuration value
    • getCalendar

      public Calendar getCalendar(String k)
      Access element from the map
      Parameters:
      k - current configuration key
      Returns:
      configuration value
    • getInstant

      public Instant getInstant(String k)
      Access element from the map
      Parameters:
      k - current configuration key
      Returns:
      configuration value
    • isAttributeExist

      public boolean isAttributeExist(String key)
      Access element from the map
      Parameters:
      key - current configuration key
      Returns:
      if key exists