SensorDataallows capturing values which come with a timestamp (
time) and a
name. While this mostly a standard definition, pay special attention to the annotations on the
objectbox:id-companion, date-nanotells ObjectBox that this is a time series enabled type. Also note that we are using nanosecond resolution (specifying
date-nanowould result in millisecond resolution). OK, this is all it needs to get the generator started:
timeproperty is absent and thus is automatically assigned to the current time. Of course, you can initialize
timebeforehand if e.g. the sensor offers a timestamp. Also, you like in standard ObjectBox, we did not assign an ID as this is done for you.