ThingWorx Edge Java SDK > Application Details > VirtualThing Component > Defining Properties
Defining Properties
You can define properties by using annotations or by calling the methods of the VirtualThing class directly. Use annotations for properties that are static, and methods for properties whose definitions are expected to change. This section explains aspects of properties and how to use them to further define a property and how The platform behaves when it needs to read a property value. It then explains how to use annotations, with examples. Finally, it explains how to use methods of the VirtualThing class to define properties. The sections are:
Registering Properties
Your Java SDK-based application must register the properties that you want to communicate to the server. The Java SDK uses an object-oriented approach to registering properties. Java Annotations map Java Bean properties (see Using Annotations). Class instances map to things on the ThingWorx platform (see VirtualThing Component). You bind instances to things on the platform (see Binding to ThingWorx Platform).
Example of Registering Properties
Here is an example of registering properties from the SteamSensor example:

import com.thingworx.communications.client.ConnectedThingClient;
import com.thingworx.communications.client.things.VirtualThing;
import com.thingworx.metadata.annotations.ThingworxPropertyDefinition;
import com.thingworx.metadata.annotations.ThingworxPropertyDefinitions;

@ThingworxPropertyDefinitions(properties = {
@ThingworxPropertyDefinition(name="Temperature", baseType="NUMBER"),
@ThingworxPropertyDefinition(name="SerialNumber", baseType="STRING")
public class JavaSDKExampleThing extends VirtualThing {
public JavaSDKExampleThing(final String name,final ConnectedThingClient client) {
super(name, null, client);

JavaSDKExampleThing steamSensorThing = new JavaSDKExampleThing("SdkSampleThing",client);
Responding to Changes from ThingWorx
Values can be pushed from the ThingWorx platform down to the edge device. In Java, the response to the push from the platform is handled automatically.
Viewing Property Bindings in ThingWorx
To see how the properties are bound to the remote thing on the ThingWorx platform (through ThingWorx Composer), follow these steps:
1. Log in to ThingWorx Composer. If you have imported the ExampleExport.xml, browse to Simple1.
2. Select the Properties tab. Here, you should see the isConnected property set to true, indicating that the connection was successful.
3. At the top, select Manage Bindings.
4. Click the Remote tab in the top left of the Manage Property Bindings window. The ThingWorx platform requests any available property bindings from your application. When the screen refreshes, you should see the Temperature property in the list of Available Properties, as shown here:
5. Drag the Temperature property to the green Drag HERE to create new properties area.
6. Click Done. When the window closes, your new property should appear in the list of properties for your remote thing.
7. Be sure to click Save at the top of the screen to save your new property. The property value should be set to the default specified in the annotation, which is 0 for this example.
Now suppose you want to know whenever the temperature changes by more than 5 degrees. You can set up your application to check the temperature value every 10 seconds and evaluate how much it has changed. If it has changed more than 5 degrees, you can push the individual property value to the server. You can also create a mashup that displays the temperature change and triggers alerts based on the change.
Alternatively, your application can look at all properties for the machine, detect that the temperature changed by more than 5 degrees, and then push all the properties to the server.
The Java SDK can do much of this work for you. All your application needs to do is to set the new value when it changes and set up the property so that it is pushed to the server when you want to push it, and the Java SDK does everything else.
For more information about property definitions see
Using Aspects
Using Annotations
Using Methods
Creating and Pushing Property Changes