class Transformers {

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

      assertCapability(m, SwitchCapability.NAMESPACE);
      Boolean on = (Boolean) params.get(Commands.OnOff.arg_on);
      if(on == null) {
         throw new ErrorEventException(Constants.Error.VALUE_OUT_OF_RANGE, Commands.OnOff.arg_on + " must be true or false");
      }
      String newState = on ? SwitchCapability.STATE_ON : SwitchCapability.STATE_OFF;
      if(!Objects.equals(SwitchModel.getState(m), newState)) {
         attrs.put(SwitchCapability.ATTR_STATE, newState);
      }
   }

   private  Transformers();

}