class Transformers {

   static void addBrightnessAttrs(Model m, ImmutableMap.Builder<String, Object> attrs, Map<String, Object> params) {
      if(params == null) {
         params = ImmutableMap.of();
      }

      assertCapability(m, DimmerCapability.NAMESPACE);
      Number b = (Number) params.get(Commands.BrightnessAbsolute.arg_brightness);
      if(b == null || b.intValue() < 0 || b.intValue() > 100) {
         throw new ErrorEventException(Constants.Error.VALUE_OUT_OF_RANGE, Commands.BrightnessAbsolute.arg_brightness + " must be between 0 and 100");
      }

      if(b.intValue() == 0) {
         b = 1;
         if(!Objects.equals(SwitchModel.getState(m), SwitchCapability.STATE_OFF)) {
            attrs.put(SwitchCapability.ATTR_STATE, SwitchCapability.STATE_OFF);
         }
      } else if(b.intValue() > 0 && !Objects.equals(SwitchModel.getState(m), SwitchCapability.STATE_ON)) {
         attrs.put(SwitchCapability.ATTR_STATE, SwitchCapability.STATE_ON);
      }

      if(!Objects.equals(DimmerModel.getBrightness(m), b.intValue())) {
         attrs.put(DimmerCapability.ATTR_BRIGHTNESS, b);
      }
   }

   private  Transformers();

}