Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
I am unsure of the best way to change the default value on a property definition on a ThingShape when that ThingShape is instantiated on 1 or more things. I am doing this from within the Java SDK.
We of course have ThingShape.AddPropertyDefinition() but once that is created, the only way I can see to update the default value is to remove the property definition and then add it again with the new data. That feels unsafe, when the shape is used by one or more Things, although I suspect that the values on things will be retained over that moment of not actually having a property definition.
I'd be interested in hearing how you folks think I should handle that situation, to remove and add, whether I need to RestarThingsImplementingThingShape afterwards, or there is a seemingly more legit way to do it or if can be added to the SDK in a future version... etc.
Thanks everyone!
As far as I know, if you are talking about persistent properties, once it are initiated the first time with the default value, the instance property won't change if you change the default value.
The only workaround could be to search for all implementing things, and if Instance Property Value it's equal to previous default value set it with the new default value.
Right of course, I am not trying to change the values on existing things. But I am trying to change the value for future yet to be created things that use that shape.
Sorry I didn't understood well the question you want to change the Default value right from code. If you really need to do it right now, you will need to use the REST API to query for ThingShape metadata, update the JSON and set it back again, you just need to see how Composer does it...