ThingWorx Edge Java SDK > Application Details > VirtualThing Component > Defining Properties > Using Methods
Using Methods
This section shows an example of creating a property definition, with a name, description, and base type, and then adding an aspect collection. The example shown below includes the following aspects: dataChangeType, dataChangeThreshold, cacheTime, isPersistent, isReadOnly, pushType, and a default value for the property. Once all the aspects are added to the collection, the aspects are set to the property definition, and the property definition is associated with the VirtualThing instance.
//Create the property definition with name, description, and baseType
PropertyDefinition property1 = new PropertyDefinition(
"Description for Property1",

//Create an aspect collection to hold all of the different aspects
AspectCollection aspects = new AspectCollection();

//Add the dataChangeType aspect
new StringPrimitive(;

//Add the dataChangeThreshold aspect
aspects.put(Aspects.ASPECT_DATACHANGETHRESHOLD, new NumberPrimitive(0.0));

//Add the cacheTime aspect
aspects.put(Aspects.ASPECT_CACHETIME, new IntegerPrimitive(0));

//Add the isPersistent aspect
aspects.put(Aspects.ASPECT_ISPERSISTENT, new BooleanPrimitive(false));

//Add the isReadOnly aspect
aspects.put(Aspects.ASPECT_ISREADONLY, new BooleanPrimitive(false));

//Add the pushType aspect
aspects.put("pushType", new StringPrimitive(;

//Add the defaultValue aspect
aspects.put(Aspects.ASPECT_DEFAULTVALUE, new BooleanPrimitive(true));

//Set the aspects of the property definition

//Add the property definition to the VirtualThing