}
JsonArray controllers = roomDescription.getJsonArray("controllers");
if (controllers != null) {
for (JsonObject controllerDescription : controllers
.getValuesAs(JsonObject.class)) {
IController controller = (IController) Class.forName(
controllerDescription.getString("class")).newInstance();
controller.setId(controllerDescription.getJsonNumber("id")
.longValue());
JsonArray sensorArray = controllerDescription
.getJsonArray("sensors");
if (sensorArray != null) {
for (JsonNumber sensorId : sensorArray
.getValuesAs(JsonNumber.class)) {
controller.attachSensor(sensorMap.get(sensorId
.intValue()));
}
}
JsonArray actuatorArray = controllerDescription
.getJsonArray("actuators");
if (actuatorArray != null) {
for (JsonNumber actuatorId : actuatorArray
.getValuesAs(JsonNumber.class)) {
controller.attachActuator(actuatorMap.get(actuatorId
.intValue()));
}
}
room.addController(controller);
}