Class ThingCode

java.lang.Object
com.thingworx.types.primitives.structs.ThingCode

@ThingworxExtensionApiClass(since={7,1}, canInstantiate=true) public class ThingCode extends Object
BaseType used to handle ThingCodes which are a numerical and unique way to identify a Thing by utilizing two key pieces of information, a domainId and an instanceId. The domain ID is a positive 32-bit integer which is registered for each organization or developer requesting one. The instance ID is a positive 64-bit integer that map to a unique Thing.

Default domainId is 0.
Default instanceId is 0.
  • Field Details

  • Constructor Details

    • ThingCode

      @ThingworxExtensionApiMethod(since={7,1}) public ThingCode()


      Construct a new ThingCode with null values for domainId and instanceId.
    • ThingCode

      @ThingworxExtensionApiMethod(since={7,1}) public ThingCode(Integer domainId, Long instanceId)


      Construct a new ThingCode with the provided domainId and instanceId.
      Parameters:
      domainId - - numerical ID that represents an organization or sub-unit
      instanceId - - numerical ID that represents a unique Thing
  • Method Details

    • getDomainId

      @ThingworxExtensionApiMethod(since={7,1}) public Integer getDomainId()


      Get the domain ID of the ThingCode.
      Returns:
      The domain ID of the ThingCode
    • setDomainId

      @ThingworxExtensionApiMethod(since={7,1}) public void setDomainId(Integer domainId)


      Set the domainId of the ThingCode.
      Parameters:
      domainId - - numerical ID that represents an organization or sub-unit
    • getInstanceId

      @ThingworxExtensionApiMethod(since={7,1}) public Long getInstanceId()


      Get the instanceId of the ThingCode.
      Returns:
      The instance ID of the ThingCode
    • setInstanceId

      @ThingworxExtensionApiMethod(since={7,1}) public void setInstanceId(Long instanceId)


      Set the instanceId of the ThingCode.
      Parameters:
      instanceId - - numerical ID that represents a unique Thing
    • compareTo

      @ThingworxExtensionApiMethod(since={7,1}) public int compareTo(Object value)
    • compare

      @ThingworxExtensionApiMethod(since={7,1}) public int compare(ThingCode v1, ThingCode v2)
    • fromMap

      @ThingworxExtensionApiMethod(since={7,1}) public static ThingCode fromMap(Map<String,Object> props)


      Construct a ThingCode from a HashMap by performing a lookup for "domainId" and "instanceId".
      Parameters:
      props - - HashMap of data
      Returns:
      A new ThingCode from the provided props
    • fromJSON

      @ThingworxExtensionApiMethod(since={7,1}) public static ThingCode fromJSON(org.json.JSONObject props)


      Construct a ThingCode from a JSONObject by performing a lookup for "domainId" and "instanceId". If either of these keys are not in the provided JSONObject, the default values for domainId and instanceId will be used.
      Parameters:
      props - - JSONObject of data
      Returns:
      A new ThingCode from the provided props
    • toMap



      Construct a new HashMap from this ThingCode instance.
      Returns:
      A new HashMap containing domain ID and instance ID
    • toJSON

      @ThingworxExtensionApiMethod(since={7,1}) public org.json.JSONObject toJSON()


      Construct a new JSONObject from this ThingCode instance.
      Returns:
      A new JSONObject containing domain ID and instance ID
    • toString

      @ThingworxExtensionApiMethod(since={7,1}) public String toString()


      Construct a String representation of this ThingCode instance.
      Overrides:
      toString in class Object
      Returns:
      A String representation of this ThingCode instance containing the domain ID and instance ID separated by ':'
    • isDefaultValue

      @ThingworxExtensionApiMethod(since={7,1}) public boolean isDefaultValue()


      Checks if the ThingCode instance is in its default state.
      Returns:
      true, if domain ID equals 0 and instance ID equals 0, false otherwise
    • fromString

      @ThingworxExtensionApiMethod(since={7,1}) public static ThingCode fromString(String value)


      Construct a new ThingCode from a String by splitting the incoming string by ':' then parsing the first string value for domainId and the second string result for instanceId.
      Parameters:
      value - - String to be parsed
      Returns:
      A new ThingCode from the provided value