Class ValueCollection
- All Implemented Interfaces:
IDiffableObject
,Serializable
,Cloneable
,Map<String,
IPrimitiveType>
- Direct Known Subclasses:
AspectCollection
HashMap
that maps Strings to Primitives.
ValueCollections are used within InfoTable
s
to represent rows of data.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
static ValueCollection
fromJSONTyped
(Object object, DataShapeDefinition type) Deprecated.getJSONSerializedValue
(String name) Deprecated.no replacementgetPrimitive
(String name) getStringValue
(String name) boolean
boolean
matches
(ValueCollection valuesToCompare) void
SetBooleanValue
(String name, Object value) Associates the specified value with the specified name.void
SetDateTimeValue
(String name, Object value) Associates the specified value with the specified name.void
SetImageValue
(String name, Object value) Associates the specified value with the specified name.void
SetInfoTableValue
(String name, Object value) Associates the specified value with the specified name.void
SetIntegerValue
(String name, Object value) Associates the specified value with the specified name.void
SetJSONValue
(String name, Object value) Associates the specified value with the specified name.void
SetLocationValue
(String name, Object value) Associates the specified value with the specified name.void
SetLongValue
(String name, Object value) Associates the specified value with the specified name.void
SetNumberValue
(String name, Object value) Associates the specified value with the specified name.void
SetStringValue
(String name, Object value) Associates the specified value with the specified name.void
SetTagsValue
(String name, Object value) Associates the specified value with the specified name.void
SetThingCodeValue
(String name, Object value) Associates the specified value with the specified name.void
setValue
(String name, IPrimitiveType value) Associates the specified value with the specified name.void
Associates the specified value with the specified name.void
SetVec2Value
(String name, Object value) Associates the specified value with the specified name.void
SetVec3Value
(String name, Object value) Associates the specified value with the specified name.void
SetVec4Value
(String name, Object value) Associates the specified value with the specified name.void
SetXMLValue
(String name, Object value) Associates the specified value with the specified name.org.json.JSONObject
toJSON()
Deprecated.no replacementorg.json.JSONObject
toJSONTyped
(DataShapeDefinition dataShapeDefinition) Deprecated.no replacementMethods inherited from class java.util.HashMap
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, newHashMap, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Constructor Details
-
ValueCollection
public ValueCollection()Initializes this instace with default values.
-
-
Method Details
-
setValue
@ThingworxExtensionApiMethod(since={6,6}) public void setValue(String name, IPrimitiveType value) throws Exception Associates the specified value with the specified name. If this collection previously contained an association for the key, the old value is replaced.- Parameters:
name
- the name with which the specified value is to be associatedvalue
- the value to be associated with the specified name- Throws:
Exception
- if an error occurs
-
SetValue
@ThingworxExtensionApiMethod(since={6,6}) public void SetValue(String name, Object value, BaseTypes baseType) throws Exception Associates the specified value with the specified name. If this collection previously contained an association for the key, the old value is replaced.This method will make its best attempt to convert the specified value to the specified Primitive.
- Parameters:
name
- the name with which the specified value is to be associatedvalue
- the value to be associated with the specified namebaseType
- the data type of the specified value- Throws:
Exception
- if an error occurs- See Also:
-
SetBooleanValue
@ThingworxExtensionApiMethod(since={6,6}) public void SetBooleanValue(String name, Object value) throws Exception Associates the specified value with the specified name. If this collection previously contained an association for the key, the old value is replaced.This is a convenience method that simply calls:
SetValue(name, value, BaseTypes.BOOLEAN)
- Parameters:
name
- the name with which the specified value is to be associatedvalue
- the value to be associated with the specified name- Throws:
Exception
- if an error occurs- See Also:
-
SetNumberValue
@ThingworxExtensionApiMethod(since={6,6}) public void SetNumberValue(String name, Object value) throws Exception Associates the specified value with the specified name. If this collection previously contained an association for the key, the old value is replaced.This is a convenience method that simply calls:
SetValue(name, value, BaseTypes.NUMBER)
- Parameters:
name
- the name with which the specified value is to be associatedvalue
- the value to be associated with the specified name- Throws:
Exception
- if an error occurs- See Also:
-
SetIntegerValue
@ThingworxExtensionApiMethod(since={6,6}) public void SetIntegerValue(String name, Object value) throws Exception Associates the specified value with the specified name. If this collection previously contained an association for the key, the old value is replaced.This is a convenience method that simply calls:
SetValue(name, value, BaseTypes.INTEGER)
- Parameters:
name
- the name with which the specified value is to be associatedvalue
- the value to be associated with the specified name- Throws:
Exception
- if an error occurs- See Also:
-
SetLongValue
@ThingworxExtensionApiMethod(since={6,6}) public void SetLongValue(String name, Object value) throws Exception Associates the specified value with the specified name. If this collection previously contained an association for the key, the old value is replaced.This is a convenience method that simply calls:
SetValue(name, value, BaseTypes.LONG)
- Parameters:
name
- the name with which the specified value is to be associatedvalue
- the value to be associated with the specified name- Throws:
Exception
- if an error occurs- See Also:
-
SetImageValue
@ThingworxExtensionApiMethod(since={6,6}) public void SetImageValue(String name, Object value) throws Exception Associates the specified value with the specified name. If this collection previously contained an association for the key, the old value is replaced.This is a convenience method that simply calls:
SetValue(name, value, BaseTypes.IMAGE)
- Parameters:
name
- the name with which the specified value is to be associatedvalue
- the value to be associated with the specified name- Throws:
Exception
- if an error occurs- See Also:
-
SetTagsValue
@ThingworxExtensionApiMethod(since={6,6}) public void SetTagsValue(String name, Object value) throws Exception Associates the specified value with the specified name. If this collection previously contained an association for the key, the old value is replaced.This is a convenience method that simply calls:
SetValue(name, value, BaseTypes.TAGS)
- Parameters:
name
- the name with which the specified value is to be associatedvalue
- the value to be associated with the specified name- Throws:
Exception
- if an error occurs- See Also:
-
SetInfoTableValue
@ThingworxExtensionApiMethod(since={6,6}) public void SetInfoTableValue(String name, Object value) throws Exception Associates the specified value with the specified name. If this collection previously contained an association for the key, the old value is replaced.This is a convenience method that simply calls:
SetValue(name, value, BaseTypes.INFOTABLE)
- Parameters:
name
- the name with which the specified value is to be associatedvalue
- the value to be associated with the specified name- Throws:
Exception
- if an error occurs- See Also:
-
SetDateTimeValue
@ThingworxExtensionApiMethod(since={6,6}) public void SetDateTimeValue(String name, Object value) throws Exception Associates the specified value with the specified name. If this collection previously contained an association for the key, the old value is replaced.This is a convenience method that simply calls:
SetValue(name, value, BaseTypes.DATETIME)
- Parameters:
name
- the name with which the specified value is to be associatedvalue
- the value to be associated with the specified name- Throws:
Exception
- if an error occurs- See Also:
-
SetStringValue
@ThingworxExtensionApiMethod(since={6,6}) public void SetStringValue(String name, Object value) throws Exception Associates the specified value with the specified name. If this collection previously contained an association for the key, the old value is replaced.This is a convenience method that simply calls:
SetValue(name, value, BaseTypes.STRING)
- Parameters:
name
- the name with which the specified value is to be associatedvalue
- the value to be associated with the specified name- Throws:
Exception
- if an error occurs- See Also:
-
SetLocationValue
@ThingworxExtensionApiMethod(since={6,6}) public void SetLocationValue(String name, Object value) throws Exception Associates the specified value with the specified name. If this collection previously contained an association for the key, the old value is replaced.This is a convenience method that simply calls:
SetValue(name, value, BaseTypes.LOCATION)
- Parameters:
name
- the name with which the specified value is to be associatedvalue
- the value to be associated with the specified name- Throws:
Exception
- if an error occurs- See Also:
-
SetVec2Value
@ThingworxExtensionApiMethod(since={7,1}) public void SetVec2Value(String name, Object value) throws Exception Associates the specified value with the specified name. If this collection previously contained an association for the key, the old value is replaced.This is a convenience method that simply calls:
SetValue(name, value, BaseTypes.VEC2)
- Parameters:
name
- the name with which the specified value is to be associatedvalue
- the value to be associated with the specified name- Throws:
Exception
- if an error occurs- See Also:
-
SetVec3Value
@ThingworxExtensionApiMethod(since={7,1}) public void SetVec3Value(String name, Object value) throws Exception Associates the specified value with the specified name. If this collection previously contained an association for the key, the old value is replaced.This is a convenience method that simply calls:
SetValue(name, value, BaseTypes.VEC3)
- Parameters:
name
- the name with which the specified value is to be associatedvalue
- the value to be associated with the specified name- Throws:
Exception
- if an error occurs- See Also:
-
SetVec4Value
@ThingworxExtensionApiMethod(since={7,1}) public void SetVec4Value(String name, Object value) throws Exception Associates the specified value with the specified name. If this collection previously contained an association for the key, the old value is replaced.This is a convenience method that simply calls:
SetValue(name, value, BaseTypes.VEC4)
- Parameters:
name
- the name with which the specified value is to be associatedvalue
- the value to be associated with the specified name- Throws:
Exception
- if an error occurs- See Also:
-
SetThingCodeValue
@ThingworxExtensionApiMethod(since={7,1}) public void SetThingCodeValue(String name, Object value) throws Exception Associates the specified value with the specified name. If this collection previously contained an association for the key, the old value is replaced.This is a convenience method that simply calls:
SetValue(name, value, BaseTypes.THINGCODE)
- Parameters:
name
- the name with which the specified value is to be associatedvalue
- the value to be associated with the specified name- Throws:
Exception
- if an error occurs- See Also:
-
SetXMLValue
@ThingworxExtensionApiMethod(since={6,6}) public void SetXMLValue(String name, Object value) throws Exception Associates the specified value with the specified name. If this collection previously contained an association for the key, the old value is replaced.This is a convenience method that simply calls:
SetValue(name, value, BaseTypes.XML)
- Parameters:
name
- the name with which the specified value is to be associatedvalue
- the value to be associated with the specified name- Throws:
Exception
- if an error occurs- See Also:
-
SetJSONValue
@ThingworxExtensionApiMethod(since={6,6}) public void SetJSONValue(String name, Object value) throws Exception Associates the specified value with the specified name. If this collection previously contained an association for the key, the old value is replaced.This is a convenience method that simply calls:
SetValue(name, value, BaseTypes.JSNO)
- Parameters:
name
- the name with which the specified value is to be associatedvalue
- the value to be associated with the specified name- Throws:
Exception
- if an error occurs- See Also:
-
getJSONSerializedValue
@Deprecated @ThingworxExtensionApiMethod(since={6,6}, deprecatedSince={8,4}) public Object getJSONSerializedValue(String name) throws Exception Deprecated.no replacementGets the JSON representation of theIPrimitiveType
property having the specified name.- Parameters:
name
- the name of the value to retrieve- Returns:
- the value, or
null
if no value with the specified name exists - Throws:
Exception
- if an exception occurs
-
getValue
-
getStringValue
-
getPrimitive
-
clone
- Overrides:
clone
in classHashMap<String,
IPrimitiveType>
-
matches
-
fromJSONTyped
@Deprecated @ThingworxExtensionApiMethod(since={6,6}, deprecatedSince={8,4}) public static ValueCollection fromJSONTyped(Object object, DataShapeDefinition type) throws Exception Deprecated.Creates aValueCollection
from the specifiedobject
, using the specified {code type} as the instructions on how to extract the values and build theValueCollection
- Parameters:
object
- the object from which to create aValueCollection
type
- describes the structure ofobject
- Returns:
- a non-null
ValueCollection
- Throws:
Exception
- if an error occurs
-
toJSONTyped
@Deprecated @ThingworxExtensionApiMethod(since={6,6}, deprecatedSince={8,4}) public org.json.JSONObject toJSONTyped(DataShapeDefinition dataShapeDefinition) throws Exception Deprecated.no replacementGets the JSON representation of this collection, populating the resulting JSON object only with properties whose names match the Fields within the specified DataShapeDefinition. If a value within this collection is null, then no entry for that value will be added to the returned JSON object, even if its name matches a Field within the DataShapeDefinition.- Parameters:
dataShapeDefinition
- contains the Fields governing how the returned JSON object is populated- Returns:
- a non-null JSON object containing only those properties from this collection whose names match Field names within the specified DataShapeDefinition
- Throws:
Exception
- if an error occurs
-
toJSON
@Deprecated @ThingworxExtensionApiMethod(since={6,6}, deprecatedSince={8,4}) public org.json.JSONObject toJSON() throws ExceptionDeprecated.no replacementReturns a JSON representation of this ValueCollection.- Returns:
- a JSON object
- Throws:
Exception
- if an error occurs
-
has
-
toInfoTable
-
toNamedValueCollection
-