In general the strategy is to use a custom adapter...
# squarelibraries
j
In general the strategy is to use a custom adapter which calls
readJsonValue()
that will give you a
Map
(for a JSON object) which you can query to determine the "shape" of the object. Then, you can delegate to the correct adapter which can parse that specific shape. So for your root object you would delegate to an adapter for a
Time
or
Sensor
object. Now the problem is fractal so you just repeat yourself. You register a custom adapter for
Sensor
which does the same thing (reads the json a "value" and inspects it) to create either an
AlwaysCondition
or a
ThresholdCondition
.