/**
 * Copyright 2014 Confluent Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.confluent.rest;

import io.confluent.common.config.AbstractConfig;
import io.confluent.common.config.ConfigDef;
import io.confluent.common.config.ConfigDef.Type;
import io.confluent.common.config.ConfigDef.Importance;

import java.util.Map;
import java.util.TreeMap;

public abstract class RestConfig extends AbstractConfig {
  protected static final ConfigDef config;

  public static final String DEBUG_CONFIG = "debug";
  private static final String DEBUG_CONFIG_DOC =
      "Boolean indicating whether extra debugging information is generated in some " +
      "error response entities.";
  private static final boolean DEBUG_CONFIG_DEFAULT = true;

  public static final String PORT_CONFIG = "port";
  private static final String PORT_CONFIG_DOC = "Port to listen on for new connections.";
  private static final int PORT_CONFIG_DEFAULT = 8080;

  public static final String RESPONSE_MEDIATYPE_PREFERRED_CONFIG = "response.mediatype.preferred";
  private static final String RESPONSE_MEDIATYPE_PREFERRED_CONFIG_DOC =
      "An ordered list of the server's preferred media types used for responses, " +
      "from most preferred to least.";
  private static final String RESPONSE_MEDIATYPE_PREFERRED_CONFIG_DEFAULT = "application/json";

  public static final String RESPONSE_MEDIATYPE_DEFAULT_CONFIG = "response.mediatype.default";
  private static final String RESPONSE_MEDIATYPE_DEFAULT_CONFIG_DOC =
      "The default response media type that should be used if no specify types are requested in " +
      "an Accept header.";
  private static final String RESPONSE_MEDIATYPE_DEFAULT_CONFIG_DEFAULT = "application/json";

  static {
    config = new ConfigDef()
        .define(DEBUG_CONFIG, Type.BOOLEAN,
                DEBUG_CONFIG_DEFAULT, Importance.HIGH, DEBUG_CONFIG_DOC)
        .define(PORT_CONFIG, Type.INT, PORT_CONFIG_DEFAULT, Importance.HIGH,
                PORT_CONFIG_DOC)
        .define(RESPONSE_MEDIATYPE_PREFERRED_CONFIG, Type.LIST,
                RESPONSE_MEDIATYPE_PREFERRED_CONFIG_DEFAULT, Importance.HIGH,
                RESPONSE_MEDIATYPE_PREFERRED_CONFIG_DOC)
        .define(RESPONSE_MEDIATYPE_DEFAULT_CONFIG, Type.STRING,
                RESPONSE_MEDIATYPE_DEFAULT_CONFIG_DEFAULT, Importance.HIGH,
                RESPONSE_MEDIATYPE_DEFAULT_CONFIG_DOC);
  }

  public RestConfig() {
    super(config, new TreeMap<Object,Object>());
  }

  public RestConfig(Map<?, ?> props) {
    super(config, props);
  }

  public static void main(String[] args) {
    System.out.println(config.toHtmlTable());
  }
}

@@ -1022,29 +1022,31 @@
 debug%22;%0A  pr
-ivate
+otected
  static fina
@@ -1190,37 +1190,39 @@
 entities.%22;%0A  pr
-ivate
+otected
  static final bo
@@ -1304,37 +1304,39 @@
 G = %22port%22;%0A  pr
-ivate
+otected
  static final St
@@ -1396,37 +1396,39 @@
 nections.%22;%0A  pr
-ivate
+otected
  static final in
@@ -1557,29 +1557,31 @@
 erred%22;%0A  pr
-ivate
+otected
  static fina
@@ -1751,37 +1751,39 @@
 to least.%22;%0A  pr
-ivate
+otected
  static final St
@@ -1949,29 +1949,31 @@
 fault%22;%0A  pr
-ivate
+otected
  static fina
@@ -2156,13 +2156,15 @@
   pr
-ivate
+otected
  sta

Make RestConfig settings available to subclasses so overriding settings doesn't require duplicating doc strings and default values.