Class PropertyTree
- java.lang.Object
- 
- com.inductiveautomation.perspective.gateway.property.PropertyTree
 
- 
 public class PropertyTree extends java.lang.ObjectThis class represents a tree structure of properties. Based on the JSON format, the structure is built up of nodes that are: - Name/Value pairs, where the name is a string and the value is another node in the tree
- Ordered list of nodes, where each node has an index starting with zero (an array)
- A primitive value, which may be null, string, or number.
 Each node in the tree also contains quality and timestamp information. Therefore, any node may be read as a QualifiedValue.Any element contained within this structure is represented by a path. The format of the path is identical to the javascript expression you would use to reference the element. For example, you could reference a root property with "foo", a sub-property with"foo.bar", an indexed property with"foo.bar[5]"and a property whose name is not a legal javascript identifier with"foo['sub property here']This tree is observable in two ways: - 
 Interested parties may register a listener for a specific path using
 subscribe(String, Set, Consumer, boolean). Whenever the value at that path has changed, the listener will receive aPropertyTreeChangeEventwhich contains theOriginand aSupplierof the new value as aQualifiedValue.
- 
 One may also listen to all changes made to the property collection using subscribeAll(Consumer). This listener will be notified of any changes.
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classPropertyTree.DollarQualifiedDatasetEncoderstatic interfacePropertyTree.Subscription
 - 
Constructor SummaryConstructors Constructor Description PropertyTree(com.inductiveautomation.ignition.common.gson.JsonObject json, ExecutionQueue queue)PropertyTree(com.inductiveautomation.ignition.common.gson.JsonObject json, ExecutionQueue queue, PropertyTreePermissionModel permissionModel)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ExecutionQueuegetQueue()java.util.List<java.lang.String>getRootKeys()booleanhasProperty(java.lang.String path)static booleanisQualifiedValueArray(java.lang.Object object)static booleanisQualifiedValueMap(java.lang.Object object)voidmerge(com.inductiveautomation.ignition.common.gson.JsonObject tree)Merges the given tree's values and structure with this tree.voidmerge(com.inductiveautomation.ignition.common.gson.JsonObject tree, boolean prune, boolean fireChange)Merge, with options.static com.inductiveautomation.ignition.common.gson.JsonObjectnewDollarQualifiedObject(java.lang.String type, QualityCode quality, long timestamp)java.util.Optional<QualifiedValue>read(JsonPath path)java.util.Optional<QualifiedValue>read(java.lang.String pathString)voidremove(JsonPath path, Origin origin, java.lang.Object source)voidreset(com.inductiveautomation.ignition.common.gson.JsonObject tree)PropertyTree.Subscriptionsubscribe(JsonPath path, java.util.Set<Origin> acceptableOrigins, java.util.function.Consumer<PropertyTreeChangeEvent> consumer)Subscribes to a specific path in the tree.PropertyTree.Subscriptionsubscribe(JsonPath path, java.util.Set<Origin> acceptableOrigins, java.util.function.Consumer<PropertyTreeChangeEvent> consumer, boolean coalesce)Subscribes to a specific path in the tree.PropertyTree.Subscriptionsubscribe(java.lang.String pathString, java.util.Set<Origin> acceptableOrigins, java.util.function.Consumer<PropertyTreeChangeEvent> consumer)Subscribes to a specific path in the tree.PropertyTree.Subscriptionsubscribe(java.lang.String pathString, java.util.Set<Origin> acceptableOrigins, java.util.function.Consumer<PropertyTreeChangeEvent> consumer, boolean coalesce)Subscribes to a specific path in the tree.voidsubscribeAll(java.util.function.Consumer<PropertyTreeChangeEvent> listener)com.inductiveautomation.ignition.common.gson.JsonObjecttoJson()Creates a JSON representation of the values in this property tree, encoded in our $-qualified format.voidwrite(JsonPath path, QualifiedValue value, Origin origin, java.lang.Object source)voidwrite(java.lang.String pathString, com.inductiveautomation.ignition.common.gson.JsonElement element, Origin origin, java.lang.Object source)voidwrite(java.lang.String pathString, QualifiedValue value, Origin origin, java.lang.Object source)voidwriteAll(com.inductiveautomation.ignition.common.gson.JsonObject writes, Origin origin, java.lang.Object source)Performs multiple writes into this property tree
 
- 
- 
- 
Constructor Detail- 
PropertyTreepublic PropertyTree(@Nonnull com.inductiveautomation.ignition.common.gson.JsonObject json, @Nonnull ExecutionQueue queue)
 - 
PropertyTreepublic PropertyTree(@Nonnull com.inductiveautomation.ignition.common.gson.JsonObject json, @Nonnull ExecutionQueue queue, @Nonnull PropertyTreePermissionModel permissionModel)
 
- 
 - 
Method Detail- 
subscribepublic PropertyTree.Subscription subscribe(java.lang.String pathString, java.util.Set<Origin> acceptableOrigins, java.util.function.Consumer<PropertyTreeChangeEvent> consumer, boolean coalesce) Subscribes to a specific path in the tree. The provided consumer will be called with aPropertyTreeChangeEventwhich contains aSupplierthat can fetch theQualifiedValuewhen it changes.- Parameters:
- pathString- The path to the property to subscribe to
- acceptableOrigins- Set of origins that this listener is interested in
- consumer- The listener that will be called when a change that affects the given path occurs
- coalesce- If true, the listener will be invoked only once for operations that may have generated multiple changes the listener is interested in.
- Returns:
- Object that contains unsubscribe() method to remove this listener
 
 - 
subscribepublic PropertyTree.Subscription subscribe(java.lang.String pathString, java.util.Set<Origin> acceptableOrigins, java.util.function.Consumer<PropertyTreeChangeEvent> consumer) Subscribes to a specific path in the tree. The provided consumer will be called with aPropertyTreeChangeEventwhich contains aSupplierthat can fetch theQualifiedValuewhen it changes.- Parameters:
- pathString- The path to the property to subscribe to
- acceptableOrigins- Set of origins that this listener is interested in
- consumer- The listener that will be called when a change that affects the given path occurs
- Returns:
- Object that contains unsubscribe() method to remove this listener
 
 - 
subscribepublic PropertyTree.Subscription subscribe(JsonPath path, java.util.Set<Origin> acceptableOrigins, java.util.function.Consumer<PropertyTreeChangeEvent> consumer, boolean coalesce) Subscribes to a specific path in the tree. The provided consumer will be called with aPropertyTreeChangeEventwhich contains aSupplierthat can fetch theQualifiedValuewhen it changes.- Parameters:
- path- The- JsonPathto the property to subscribe to
- acceptableOrigins- Set of origins that this listener is interested in
- consumer- The listener that will be called when a change that affects the given path occurs
- coalesce- If true, the listener will be invoked only once for operations that may have generated multiple changes the listener is interested in.
- Returns:
- Object that contains unsubscribe() method to remove this listener
 
 - 
subscribepublic PropertyTree.Subscription subscribe(JsonPath path, java.util.Set<Origin> acceptableOrigins, java.util.function.Consumer<PropertyTreeChangeEvent> consumer) Subscribes to a specific path in the tree. The provided consumer will be called with aPropertyTreeChangeEventwhich contains aSupplierthat can fetch theQualifiedValuewhen it changes.- Parameters:
- path- The- JsonPathto the property to subscribe to
- acceptableOrigins- Set of origins that this listener is interested in
- consumer- The listener that will be called when a change that affects the given path occurs
- Returns:
- Object that contains unsubscribe() method to remove this listener
 
 - 
subscribeAllpublic void subscribeAll(java.util.function.Consumer<PropertyTreeChangeEvent> listener) 
 - 
mergepublic void merge(com.inductiveautomation.ignition.common.gson.JsonObject tree) Merges the given tree's values and structure with this tree. New structure and values from the given tree may be added to this one. No changes fired.
 - 
mergepublic void merge(com.inductiveautomation.ignition.common.gson.JsonObject tree, boolean prune, boolean fireChange)Merge, with options.- Parameters:
- prune- If true, existing nodes that aren't in the new merge tree will be removed
- fireChange- If true, the change listeners will be notified of the changes due to the merge.
 
 - 
resetpublic void reset(com.inductiveautomation.ignition.common.gson.JsonObject tree) 
 - 
getQueuepublic ExecutionQueue getQueue() 
 - 
readpublic java.util.Optional<QualifiedValue> read(java.lang.String pathString) 
 - 
readpublic java.util.Optional<QualifiedValue> read(JsonPath path) 
 - 
writeAllpublic void writeAll(com.inductiveautomation.ignition.common.gson.JsonObject writes, Origin origin, java.lang.Object source)Performs multiple writes into this property tree- Parameters:
- writes- An object containing paths of properties to write to and the values to write to them
- origin- where the write came from
 
 - 
writepublic void write(java.lang.String pathString, com.inductiveautomation.ignition.common.gson.JsonElement element, Origin origin, java.lang.Object source)
 - 
writepublic void write(java.lang.String pathString, QualifiedValue value, Origin origin, java.lang.Object source)
 - 
writepublic void write(JsonPath path, QualifiedValue value, Origin origin, java.lang.Object source) 
 - 
hasPropertypublic boolean hasProperty(java.lang.String path) - Parameters:
- path- Path to look for - should be parseable by- JsonPath.parse(java.lang.String)
- Returns:
- true if there is a property for the given path
 
 - 
getRootKeyspublic java.util.List<java.lang.String> getRootKeys() 
 - 
toJsonpublic com.inductiveautomation.ignition.common.gson.JsonObject toJson() Creates a JSON representation of the values in this property tree, encoded in our $-qualified format. Will not include properties marked as access=PRIVATE
 - 
newDollarQualifiedObjectpublic static com.inductiveautomation.ignition.common.gson.JsonObject newDollarQualifiedObject(java.lang.String type, QualityCode quality, long timestamp)
 - 
isQualifiedValueMappublic static boolean isQualifiedValueMap(@Nullable java.lang.Object object)
 - 
isQualifiedValueArraypublic static boolean isQualifiedValueArray(java.lang.Object object) 
 
- 
 
-