ThingWorx Edge Java SDK > Working with Things > Properties
  
Properties
Posting data to ThingWorx would become really complex if you just made service calls to update property values. Using the Java SDK in conjunction with the ThingWorx platform, you can collect and store information about a device in the form of properties and property values. In addition, property subscription allow your ThingWorx platform to ask for property values that it wants and update them automatically. The subscribed property management suite also provides convenient features such as:
Allowing changes to be delivered in batches
Pushing changes only when values change based on a configurable threshold
Allowing changes to be folded or reduced
Your Java SDK-based application must register the properties that you want to communicate to the server. Pushing (described later) is the process of sending queued batches of updates to the ThingWorx platform.
How to Collect Device Data
The Java SDK and the ThingWorx platform provide three ways to collect information about a device:
Fetch a property value when the server needs it by sending a request from the server to the device. The device sends the current property value only on request.
Collect a new value at the device, store it, and then forward it to the server. The device sends the value only when it changes.
Set up a cycle at the device for collecting property values and pushing them to the server. You can use the UpdateSubscribedProperties method and set up this cycle to regularly send a set of property values, whether or not they have changed.
For example, suppose you want to monitor the temperature of a machine. You can add a property to the VirtualThing in your client application and call it Temperature. Once the ConnectedThingClient registers with the ThingWorx platform, you can add the property to the corresponding remote thing on the server.
Defining a Property on a VirtualThing
To define a property on a VirtualThing, you can use the annotation, ThingworxPropertyDefinitions.
* 
If your VirtualThing uses annotations to define properties, services, or events, you should call this.initializeFromAnnotations() (shown below). If you do not call this method, the annotations are NOT applied to your thing.
The following example of an annotation is taken from the source file, SimpleThing.java:
@ThingworxPropertyDefinitions(properties = {

@ThingworxPropertyDefinition(name="Temperature",
description="The device temperature",
baseType="NUMBER",
aspects={"dataChangeType:NEVER",
"dataChangeThreshold:0",
"cacheTime:-1",
"isPersistent:FALSE",
"isReadOnly:FALSE",
"pushType:NEVER",
"defaultValue:0"})
})
public class SimpleThing extends VirtualThing {

private static final Logger LOG =
LoggerFactory.getLogger(SimpleThing.class);

public SimpleThing(String name, String description,
ConnectedThingClient client)
{
super(name, description, client);
this.initializeFromAnnotations();
}
As long as you have set up Gradle and followed the instructions in the topic, Running the SimpleThingClient, the application should be running. If not, run the application again (gradle SimpleThingClient).