Class Document
java.lang.Object
com.inductiveautomation.ignition.common.document.DocumentElement
com.inductiveautomation.ignition.common.document.Document
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ExtendedDocument
A class representing an object type in Json. An object consists of name-value pairs where names are strings, and
values are any other type of
DocumentElement. This allows for a creating a tree of DocumentElements. The
member elements of this object are maintained in order they were added.- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(String property, DocumentElement value) Adds a member, which is a name-value pair, to self.voidConvenience method to add a boolean member.voidConvenience method to add a char member.voidConvenience method to add a primitive member.voidConvenience method to add a primitive member.voidaddProperty(String property, Object value) static DocumentElementcreateDocumentElement(Object value) Creates the properDocumentElementobject from the givenvalueobject.deepCopy()Creates a deep copy of this element and all its childrenentrySet()Returns a set of members of this object.booleanReturns the member with the specified name.getAsDocument(String memberName) Convenience method to get the specified member as a Document.getAsDocumentArray(String memberName) Convenience method to get the specified member as a JsonArray.getAsDocumentPrimitive(String memberName) Convenience method to get the specified member as a JsonPrimitive element.booleanConvenience method to check if a member with the specified name is present in this object.inthashCode()keySet()Returns a set of members key values.Removes thepropertyfrom thisDocument.intsize()Returns the number of key/value pairs in the object.com.inductiveautomation.ignition.common.gson.JsonObjectprotected Set<Map.Entry<String,DocumentElement>> 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
-
Field Details
-
members
-
-
Constructor Details
-
Document
public Document() -
Document
public Document(int size) -
Document
public Document(com.inductiveautomation.ignition.common.gson.JsonObject json)
-
-
Method Details
-
deepCopy
Creates a deep copy of this element and all its children- Specified by:
deepCopyin classDocumentElement
-
toJsonElement
public com.inductiveautomation.ignition.common.gson.JsonObject toJsonElement()- Specified by:
toJsonElementin classDocumentElement
-
add
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.- Parameters:
property- name of the member.value- the member object.
-
remove
Removes thepropertyfrom thisDocument.- Parameters:
property- name of the member that should be removed.- Returns:
- the
DocumentElementobject that is being removed.
-
add
Convenience method to add a primitive member. The specified value is converted to a JsonPrimitive of String.- Parameters:
property- name of the member.value- the string value associated with the member.
-
add
Convenience method to add a primitive member. The specified value is converted to a JsonPrimitive of Number.- Parameters:
property- name of the member.value- the number value associated with the member.
-
add
Convenience method to add a boolean member. The specified value is converted to a JsonPrimitive of Boolean.- Parameters:
property- name of the member.value- the number value associated with the member.
-
add
Convenience method to add a char member. The specified value is converted to a JsonPrimitive of Character.- Parameters:
property- name of the member.value- the number value associated with the member.
-
addProperty
-
createDocumentElement
Creates the properDocumentElementobject from the givenvalueobject. Supports arrays of primatives or DocumentElement, or scalar primatives.- Parameters:
value- the object to generate theDocumentElementfor- Returns:
- a
DocumentElementif thevalueis not null, otherwise aJsonNull
-
unsafeEntrySet
-
entrySet
Returns a set of members of this object. The set is ordered, and the order is in which the elements were added.- Returns:
- a set of members of this object.
-
keySet
Returns a set of members key values.- Returns:
- a set of member keys as Strings
-
size
public int size()Returns the number of key/value pairs in the object.- Returns:
- the number of key/value pairs in the object.
-
has
Convenience method to check if a member with the specified name is present in this object.- 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
Returns the member with the specified name.- Parameters:
memberName- name of the member that is being requested.- Returns:
- the member matching the name. Null if no such member exists.
-
getAsDocumentPrimitive
Convenience method to get the specified member as a JsonPrimitive element.- Parameters:
memberName- name of the member being requested.- Returns:
- the JsonPrimitive corresponding to the specified member.
-
getAsDocumentArray
Convenience method to get the specified member as a JsonArray.- Parameters:
memberName- name of the member being requested.- Returns:
- the JsonArray corresponding to the specified member.
-
getAsDocument
Convenience method to get the specified member as a Document.- Parameters:
memberName- name of the member being requested.- Returns:
- the Document corresponding to the specified member.
-
equals
-
hashCode
public int hashCode()
-