Class ExtendedDocument

All Implemented Interfaces:
Serializable

public class ExtendedDocument extends Document
Allows cloning a Document without having to create a deep copy of all it's elements. This is managed by tracking all modifications to a delegate Document instead of applying those modifications directly to the Document. If extend(com.inductiveautomation.ignition.common.document.Document) is called on an ExtendedDocument the delegate Document is reused and modifications are copied to the new ExtendedDocument.

It's extremely important that the delegate Document is never modified. In cases where the delegate Document might change, Document.deepCopy() should be used instead.
See Also:
  • Method Details

    • extend

      public static Document extend(Document document)
    • deepCopy

      public Document deepCopy()
      Description copied from class: Document
      Creates a deep copy of this element and all its children
      Overrides:
      deepCopy in class Document
    • unsafeEntrySet

      protected Set<Map.Entry<String,DocumentElement>> unsafeEntrySet()
      Overrides:
      unsafeEntrySet in class Document
    • add

      public void add(String property, DocumentElement value)
      Description copied from class: Document
      Adds a member, which is a name-value pair, to self. The name must be a String, but the value can be an arbitrary DocumentElement, thereby allowing you to build a full tree of DocumentElements rooted at this node.
      Overrides:
      add in class Document
      Parameters:
      property - name of the member.
      value - the member object.
    • remove

      public DocumentElement remove(String property)
      Description copied from class: Document
      Removes the property from this Document.
      Overrides:
      remove in class Document
      Parameters:
      property - name of the member that should be removed.
      Returns:
      the DocumentElement object that is being removed.
    • addProperty

      public void addProperty(String property, Object value)
      Overrides:
      addProperty in class Document
    • entrySet

      public Set<Map.Entry<String,DocumentElement>> entrySet()
      Description copied from class: Document
      Returns a set of members of this object. The set is ordered, and the order is in which the elements were added.
      Overrides:
      entrySet in class Document
      Returns:
      a set of members of this object.
    • keySet

      public Set<String> keySet()
      Description copied from class: Document
      Returns a set of members key values.
      Overrides:
      keySet in class Document
      Returns:
      a set of member keys as Strings
    • size

      public int size()
      Description copied from class: Document
      Returns the number of key/value pairs in the object.
      Overrides:
      size in class Document
      Returns:
      the number of key/value pairs in the object.
    • has

      public boolean has(String memberName)
      Description copied from class: Document
      Convenience method to check if a member with the specified name is present in this object.
      Overrides:
      has in class Document
      Parameters:
      memberName - name of the member that is being checked for presence.
      Returns:
      true if there is a member with the specified name, false otherwise.
    • get

      public DocumentElement get(String memberName)
      Description copied from class: Document
      Returns the member with the specified name.
      Overrides:
      get in class Document
      Parameters:
      memberName - name of the member that is being requested.
      Returns:
      the member matching the name. Null if no such member exists.
    • getAsDocumentPrimitive

      public DocumentPrimitive getAsDocumentPrimitive(String memberName)
      Description copied from class: Document
      Convenience method to get the specified member as a JsonPrimitive element.
      Overrides:
      getAsDocumentPrimitive in class Document
      Parameters:
      memberName - name of the member being requested.
      Returns:
      the JsonPrimitive corresponding to the specified member.
    • getAsDocumentArray

      public DocumentArray getAsDocumentArray(String memberName)
      Description copied from class: Document
      Convenience method to get the specified member as a JsonArray.
      Overrides:
      getAsDocumentArray in class Document
      Parameters:
      memberName - name of the member being requested.
      Returns:
      the JsonArray corresponding to the specified member.
    • getAsDocument

      public Document getAsDocument(String memberName)
      Description copied from class: Document
      Convenience method to get the specified member as a Document.
      Overrides:
      getAsDocument in class Document
      Parameters:
      memberName - name of the member being requested.
      Returns:
      the Document corresponding to the specified member.