Class ValueCollection

All Implemented Interfaces:
IDiffableObject, Serializable, Cloneable, Map<String,IPrimitiveType>
Direct Known Subclasses:
AspectCollection

@ThingworxExtensionApiClass(since={6,6}, canInstantiate=true) public class ValueCollection extends HashMap<String,IPrimitiveType> implements Cloneable, IDiffableObject
A ValueCollection is a HashMap that maps Strings to Primitives. ValueCollections are used within InfoTables to represent rows of data.
See Also:
  • 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 associated
      value - 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 associated
      value - the value to be associated with the specified name
      baseType - 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 associated
      value - 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 associated
      value - 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 associated
      value - 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 associated
      value - 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 associated
      value - 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 associated
      value - 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 associated
      value - 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 associated
      value - 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 associated
      value - 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 associated
      value - 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 associated
      value - 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 associated
      value - 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 associated
      value - 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 associated
      value - 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 associated
      value - 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 associated
      value - 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 replacement
      Gets the JSON representation of the IPrimitiveType 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

      @ThingworxExtensionApiMethod(since={6,6}) public Object getValue(String name)
    • getStringValue

      @ThingworxExtensionApiMethod(since={6,6}) public String getStringValue(String name)
    • getPrimitive

      @ThingworxExtensionApiMethod(since={6,6}) public IPrimitiveType getPrimitive(String name)
    • clone

      Overrides:
      clone in class HashMap<String,IPrimitiveType>
    • matches

      @ThingworxExtensionApiMethod(since={6,6}) public boolean matches(ValueCollection valuesToCompare)
    • fromJSONTyped

      @Deprecated @ThingworxExtensionApiMethod(since={6,6}, deprecatedSince={8,4}) public static ValueCollection fromJSONTyped(Object object, DataShapeDefinition type) throws Exception
      Deprecated.
      Creates a ValueCollection from the specified object, using the specified {code type} as the instructions on how to extract the values and build the ValueCollection
      Parameters:
      object - the object from which to create a ValueCollection
      type - describes the structure of object
      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 replacement
      Gets 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 Exception
      Deprecated.
      no replacement
      Returns a JSON representation of this ValueCollection.
      Returns:
      a JSON object
      Throws:
      Exception - if an error occurs
    • has

      @ThingworxExtensionApiMethod(since={6,6}) public boolean has(String name)
    • toInfoTable

      @ThingworxExtensionApiMethod(since={6,6}) public InfoTable toInfoTable()
    • toNamedValueCollection

      @ThingworxExtensionApiMethod(since={6,6}) public NamedValueCollection toNamedValueCollection()