Пример #1
0
 private static Device create(String rfAddress, List<DeviceConfiguration> configurations) {
   Device returnValue = null;
   for (DeviceConfiguration c : configurations) {
     if (c.getRFAddress().toUpperCase().equals(rfAddress.toUpperCase())) {
       switch (c.getDeviceType()) {
         case HeatingThermostatPlus:
         case HeatingThermostat:
           HeatingThermostat thermostat = new HeatingThermostat(c);
           thermostat.setType(c.getDeviceType());
           return thermostat;
         case EcoSwitch:
           return new EcoSwitch(c);
         case ShutterContact:
           return new ShutterContact(c);
         case WallMountedThermostat:
           return new WallMountedThermostat(c);
         default:
           return new UnsupportedDevice(c);
       }
     }
   }
   return returnValue;
 }