class Transformers {

   static Optional<GoogleColor> modelToColor(Model m) {
      if(m == null) {
         return Optional.empty();
      }
      if(!m.supports(ColorTemperatureCapability.NAMESPACE) && !m.supports(ColorCapability.NAMESPACE)) {
         return Optional.empty();
      }

      GoogleColor color = new GoogleColor();
      if(m.supports(ColorTemperatureCapability.NAMESPACE)) {
         color.setTemperature(ColorTemperatureModel.getColortemp(m));
      }
      if(m.supports(ColorCapability.NAMESPACE)) {
         color.setSpectrumRGB(new Colors.HSB(
               ColorModel.getHue(m),
               ColorModel.getSaturation(m),
               m.supports(DimmerCapability.NAMESPACE) ? DimmerModel.getBrightness(m) : 100
         ).toRGB().toInt());
      }
      return Optional.of(color);
   }

   private  Transformers();

}