Using Annotations
The preferred method of defining properties, services, and events is to use annotations. This topic provides examples for properties.
The @ThingWorxPropertyDefinitions annotation contains all the child @ThingWorxPropertyDefinition annotations. Annotations are placed at the beginning of the main code file, after the import and initial statements.
Here are examples that define properties, using annotations to set the name, description, and baseType attributes as well as the set of aspects. You can find this code in the SteamThing.java example source file
Example 2. SteamSensor Properties

// Property Definitions
@SuppressWarnings("serial")
@ThingworxPropertyDefinitions(properties = {
@ThingworxPropertyDefinition(name = "Temperature", description = "Current Temperature",
baseType = "NUMBER", category = "Status", aspects = { "isReadOnly:true" }),
@ThingworxPropertyDefinition(name = "Pressure", description = "Current Pressure",
baseType = "NUMBER", category = "Status", aspects = { "isReadOnly:true" }),
@ThingworxPropertyDefinition(name = "FaultStatus", description = "Fault status",
baseType = "BOOLEAN", category = "Faults", aspects = { "isReadOnly:true" }),
@ThingworxPropertyDefinition(name = "InletValve", description = "Inlet valve state",
baseType = "BOOLEAN", category = "Status", aspects = { "isReadOnly:true" }),
@ThingworxPropertyDefinition(name = "TemperatureLimit",
description = "Temperature fault limit", baseType = "NUMBER", category = "Faults",
aspects = { "isReadOnly:false" }),
@ThingworxPropertyDefinition(name = "Location", description = "location of sensor",
baseType = "LOCATION", category = "Status", aspects = { "isReadOnly:true" }),
@ThingworxPropertyDefinition(name = "TotalFlow", description = "Total flow",
baseType = "NUMBER", category = "Aggregates", aspects = { "isReadOnly:true" }), })
What Happens with the Aspects Set on a Property?
The aspect values that are set on a property at the edge are passed to the ThingWorx Platform when a property is first bound at the platform. The aspects can then be displayed and edited in the Properties page for a Thing in ThingWorx Composer. When aspect values are changed in Composer, the new values are sent back to the device during synchronization. Only after the synchronization does the device adopt the new values. The developer sets the default values for aspects, but then a Composer user is allowed to modify future device behavior, as long as the user has the appropriate permissions and visibility.
Was this helpful?