code: @Override
      public T put(String key, T value) {
          if (StringUtils.isBlank(key)) {
              throw new MultiEnvSupportException(String.format("Expected non-empty value for environment, was: %s", key));
          }
          boolean isDefaultEnvironment = false;
          if (value instanceof MultiEnvDefaultedConfiguration) {
              isDefaultEnvironment = ((MultiEnvDefaultedConfiguration) value).isDefault();
              if (isDefaultEnvironment && this.hasDefaultEnvironment()) {
                  throw new MultiEnvSupportException(String.format(
                          "Only one default environment is allowed per instance. Found %s and %s",
                          key, defaultEnvironment));
              } else if (isDefaultEnvironment) {
                  this.defaultEnvironment = key;
              }
          }
          if (value instanceof MultiEnvTemplateConfiguration) {
              boolean isTemplateEnvironment = ((MultiEnvTemplateConfiguration) value).isTemplate();
              if (isTemplateEnvironment && this.hasTemplateEnvironment()) {
                  throw new MultiEnvSupportException(String.format(
                          "Only one template environment is allowed per instance. Found %s and %s",
                          key, templateEnvironment));
              } else if (isTemplateEnvironment && isDefaultEnvironment) {
                  throw new MultiEnvSupportException(String.format(
                          "You cannot have a configuration be a default and a template at the same time. Found %s", key));
              } else if (isTemplateEnvironment) {
                  this.templateEnvironment = key;
              }
          }
          return map.put(key, value);
      }
docs: {@inheritDoc}