Class ExtendedDocument
- java.lang.Object
-
- com.inductiveautomation.ignition.common.document.DocumentElement
-
- com.inductiveautomation.ignition.common.document.Document
-
- com.inductiveautomation.ignition.common.document.ExtendedDocument
-
- All Implemented Interfaces:
java.io.Serializable
public class ExtendedDocument extends Document
Allows cloning aDocumentwithout 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. Ifextend(com.inductiveautomation.ignition.common.document.Document)is called on anExtendedDocumentthe delegate Document is reused and modifications are copied to the newExtendedDocument.
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:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(java.lang.String property, DocumentElement value)Adds a member, which is a name-value pair, to self.voidaddProperty(java.lang.String property, java.lang.Object value)DocumentdeepCopy()Creates a deep copy of this element and all its childrenjava.util.Set<java.util.Map.Entry<java.lang.String,DocumentElement>>entrySet()Returns a set of members of this object.static Documentextend(Document document)DocumentElementget(java.lang.String memberName)Returns the member with the specified name.DocumentgetAsDocument(java.lang.String memberName)Convenience method to get the specified member as a Document.DocumentArraygetAsDocumentArray(java.lang.String memberName)Convenience method to get the specified member as a JsonArray.DocumentPrimitivegetAsDocumentPrimitive(java.lang.String memberName)Convenience method to get the specified member as a JsonPrimitive element.booleanhas(java.lang.String memberName)Convenience method to check if a member with the specified name is present in this object.java.util.Set<java.lang.String>keySet()Returns a set of members key values.DocumentElementremove(java.lang.String property)Removes thepropertyfrom thisDocument.intsize()Returns the number of key/value pairs in the object.protected java.util.Set<java.util.Map.Entry<java.lang.String,DocumentElement>>unsafeEntrySet()-
Methods inherited from class com.inductiveautomation.ignition.common.document.Document
add, add, add, add, equals, hashCode, toJsonElement
-
Methods inherited from class com.inductiveautomation.ignition.common.document.DocumentElement
fromJson, getAsBigDecimal, getAsBigInteger, getAsBoolean, getAsByte, getAsCharacter, getAsDocument, getAsDocumentArray, getAsDocumentNull, getAsDocumentPrimitive, getAsDouble, getAsFloat, getAsInt, getAsLong, getAsNumber, getAsShort, getAsString, isDocument, isDocumentArray, isDocumentNull, isDocumentPrimitive, toString, toStringNoIndent
-
-
-
-
Method Detail
-
deepCopy
public Document deepCopy()
Description copied from class:DocumentCreates a deep copy of this element and all its children
-
unsafeEntrySet
protected java.util.Set<java.util.Map.Entry<java.lang.String,DocumentElement>> unsafeEntrySet()
- Overrides:
unsafeEntrySetin classDocument
-
add
public void add(java.lang.String property, DocumentElement value)Description copied from class:DocumentAdds 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.
-
remove
public DocumentElement remove(java.lang.String property)
Description copied from class:DocumentRemoves thepropertyfrom thisDocument.- Overrides:
removein classDocument- Parameters:
property- name of the member that should be removed.- Returns:
- the
DocumentElementobject that is being removed.
-
addProperty
public void addProperty(java.lang.String property, java.lang.Object value)- Overrides:
addPropertyin classDocument
-
entrySet
public java.util.Set<java.util.Map.Entry<java.lang.String,DocumentElement>> entrySet()
Description copied from class:DocumentReturns a set of members of this object. The set is ordered, and the order is in which the elements were added.
-
keySet
public java.util.Set<java.lang.String> keySet()
Description copied from class:DocumentReturns a set of members key values.
-
size
public int size()
Description copied from class:DocumentReturns the number of key/value pairs in the object.
-
has
public boolean has(java.lang.String memberName)
Description copied from class:DocumentConvenience method to check if a member with the specified name is present in this object.
-
get
public DocumentElement get(java.lang.String memberName)
Description copied from class:DocumentReturns the member with the specified name.
-
getAsDocumentPrimitive
public DocumentPrimitive getAsDocumentPrimitive(java.lang.String memberName)
Description copied from class:DocumentConvenience method to get the specified member as a JsonPrimitive element.- Overrides:
getAsDocumentPrimitivein classDocument- Parameters:
memberName- name of the member being requested.- Returns:
- the JsonPrimitive corresponding to the specified member.
-
getAsDocumentArray
public DocumentArray getAsDocumentArray(java.lang.String memberName)
Description copied from class:DocumentConvenience method to get the specified member as a JsonArray.- Overrides:
getAsDocumentArrayin classDocument- Parameters:
memberName- name of the member being requested.- Returns:
- the JsonArray corresponding to the specified member.
-
getAsDocument
public Document getAsDocument(java.lang.String memberName)
Description copied from class:DocumentConvenience method to get the specified member as a Document.- Overrides:
getAsDocumentin classDocument- Parameters:
memberName- name of the member being requested.- Returns:
- the Document corresponding to the specified member.
-
-