// Path: croquet-core/src/main/java/com/metrink/croquet/AbstractSettings.java
// public abstract class AbstractSettings implements Serializable {
//     private static final long serialVersionUID = -2385834291456376380L;
//     private static final Logger LOG = LoggerFactory.getLogger(AbstractSettings.class);
// 
//     private static final int DEFAULT_PORT = 8080;
// 
//     @JsonProperty("development")
//     private Boolean development = false;
// 
//     @JsonProperty("port")
//     private Integer port = DEFAULT_PORT;
// 
//     @JsonProperty("pid_file")
//     private String pidFile;
// 
//     @JsonProperty("logging")
//     private LoggingSettings loggingSettings = new LoggingSettings();
// 
//     @JsonProperty("db")
//     private DatabaseSettings dbSettings;
// 
// 
//     /**
//      * Perform post de-serialization modification of the Settings.
//      */
//     protected final void initialize() {
//         // Enabling development mode forces these settings. This is somewhat inelegant, because to configure one of
//         // these values differently will require disabling development mode and manually configure the remaining values.
//         if (development) {
//             loggingSettings.getLoggers().put("org.hibernate.SQL", Level.DEBUG);
//             loggingSettings.getLoggers().put("com.metrink.croquet", Level.DEBUG);
//         }
// 
//         // call the class's init method
//         init();
//     }
// 
//     /**
//      * Perform post de-serialization modification of the Settings.
//      */
//     protected abstract void init();
// 
//     /**
//      * Helper method used to obtain a class from a fully qualified class name. If the value is null or an exception is
//      * thrown, return the default result instead.
//      * @param className the fully qualified class name to try
//      * @param defaultResult the nullable default result
//      * @param <T> the class type
//      * @return the class or null
//      */
//     @SuppressWarnings("unchecked")
//     protected <T> Class<T> getClassOrDefault(final String className, final Class<T> defaultResult) {
//         try {
//             return className == null
//                     ? defaultResult
//                     : (Class<T>)Class.forName(className);
//         } catch (final ClassNotFoundException e) {
//             LOG.error("ClassNotFoundException for {} - defaulting to {}", className, defaultResult);
//             return defaultResult;
//         }
//     }
// 
//     /**
//      * In development mode?
//      * Defaults to false to avoid accidental deployment of development mode in production.
//      * @return true if in development mode
//      */
//     public Boolean getDevelopment() {
//         return development;
//     }
// 
//     /**
//      * Get the TCP port which will be bound to Jetty.
//      * @return the port
//      */
//     public int getPort() {
//         return port;
//     }
// 
// 
//     /**
//      * Get the {@link DatabaseSettings}.
//      * @return the {@link DatabaseSettings}.
//      */
//     public DatabaseSettings getDatabaseSettings() {
//         return dbSettings;
//     }
// 
//     /**
//      * Get the {@link LoggingSettings}.
//      * @return the {@link LoggingSettings}.
//      */
//     public LoggingSettings getLoggingSettings() {
//         return loggingSettings;
//     }
// 
//     /**
//      * Get pidFile.
//      * @return the pidFile
//      */
//     public String getPidFile() {
//         return pidFile;
//     }
// 
//     /**
//      * Set pidFile.
//      * @param pidFile the pidFile to set
//      */
//     public void setPidFile(final String pidFile) {
//         this.pidFile = pidFile;
//     }
// 
// }
// 
// Path: croquet-core/src/main/java/com/metrink/croquet/RestSettings.java
// public class RestSettings extends AbstractSettings {
//     private static final long serialVersionUID = -4071324712275262138L;
// 
//     private List<String> providerPackages = new ArrayList<>();
// 
//     /**
//      * Perform post de-serialization modification of the Settings.
//      */
//     @Override
//     protected void init() {
//     }
// 
//     /**
//      * Gets the list of provider packages.
//      * @return list of provider packages.
//      */
//     public List<String> getProviderPackages() {
//         return Collections.unmodifiableList(providerPackages);
//     }
// 
//     /**
//      * Adds a provider package to the list.
//      * @param providerPackage the provider package to add.
//      */
//     public void addProviderPackage(final String providerPackage) {
//         providerPackages.add(providerPackage);
//     }
// 
// }


import com.google.inject.AbstractModule;
import com.metrink.croquet.AbstractSettings;
import com.metrink.croquet.RestSettings;
package com.metrink.croquet.inject;


/**
 * Croquet's Guice module that configures most of the dependencies.
 * @param <T> the subclass type of the settings instance
 */
public class CroquetRestModule<T extends RestSettings> extends AbstractModule {

    private final T settings;
    private Class<T> clazz;

    /**
     * Constructor for the CroquetModule.
     * @param clazz the settings base class.
     * @param settings the settings.
     */
    public CroquetRestModule(final Class<T> clazz, final T settings) {
        this.clazz = clazz;
        this.settings = settings;
    }

    @Override
    protected void configure() {
        // bind the settings classes
// Path: croquet-core/src/main/java/com/metrink/croquet/AbstractSettings.java
// public abstract class AbstractSettings implements Serializable {
//     private static final long serialVersionUID = -2385834291456376380L;
//     private static final Logger LOG = LoggerFactory.getLogger(AbstractSettings.class);
// 
//     private static final int DEFAULT_PORT = 8080;
// 
//     @JsonProperty("development")
//     private Boolean development = false;
// 
//     @JsonProperty("port")
//     private Integer port = DEFAULT_PORT;
// 
//     @JsonProperty("pid_file")
//     private String pidFile;
// 
//     @JsonProperty("logging")
//     private LoggingSettings loggingSettings = new LoggingSettings();
// 
//     @JsonProperty("db")
//     private DatabaseSettings dbSettings;
// 
// 
//     /**
//      * Perform post de-serialization modification of the Settings.
//      */
//     protected final void initialize() {
//         // Enabling development mode forces these settings. This is somewhat inelegant, because to configure one of
//         // these values differently will require disabling development mode and manually configure the remaining values.
//         if (development) {
//             loggingSettings.getLoggers().put("org.hibernate.SQL", Level.DEBUG);
//             loggingSettings.getLoggers().put("com.metrink.croquet", Level.DEBUG);
//         }
// 
//         // call the class's init method
//         init();
//     }
// 
//     /**
//      * Perform post de-serialization modification of the Settings.
//      */
//     protected abstract void init();
// 
//     /**
//      * Helper method used to obtain a class from a fully qualified class name. If the value is null or an exception is
//      * thrown, return the default result instead.
//      * @param className the fully qualified class name to try
//      * @param defaultResult the nullable default result
//      * @param <T> the class type
//      * @return the class or null
//      */
//     @SuppressWarnings("unchecked")
//     protected <T> Class<T> getClassOrDefault(final String className, final Class<T> defaultResult) {
//         try {
//             return className == null
//                     ? defaultResult
//                     : (Class<T>)Class.forName(className);
//         } catch (final ClassNotFoundException e) {
//             LOG.error("ClassNotFoundException for {} - defaulting to {}", className, defaultResult);
//             return defaultResult;
//         }
//     }
// 
//     /**
//      * In development mode?
//      * Defaults to false to avoid accidental deployment of development mode in production.
//      * @return true if in development mode
//      */
//     public Boolean getDevelopment() {
//         return development;
//     }
// 
//     /**
//      * Get the TCP port which will be bound to Jetty.
//      * @return the port
//      */
//     public int getPort() {
//         return port;
//     }
// 
// 
//     /**
//      * Get the {@link DatabaseSettings}.
//      * @return the {@link DatabaseSettings}.
//      */
//     public DatabaseSettings getDatabaseSettings() {
//         return dbSettings;
//     }
// 
//     /**
//      * Get the {@link LoggingSettings}.
//      * @return the {@link LoggingSettings}.
//      */
//     public LoggingSettings getLoggingSettings() {
//         return loggingSettings;
//     }
// 
//     /**
//      * Get pidFile.
//      * @return the pidFile
//      */
//     public String getPidFile() {
//         return pidFile;
//     }
// 
//     /**
//      * Set pidFile.
//      * @param pidFile the pidFile to set
//      */
//     public void setPidFile(final String pidFile) {
//         this.pidFile = pidFile;
//     }
// 
// }
// 
// Path: croquet-core/src/main/java/com/metrink/croquet/RestSettings.java
// public class RestSettings extends AbstractSettings {
//     private static final long serialVersionUID = -4071324712275262138L;
// 
//     private List<String> providerPackages = new ArrayList<>();
// 
//     /**
//      * Perform post de-serialization modification of the Settings.
//      */
//     @Override
//     protected void init() {
//     }
// 
//     /**
//      * Gets the list of provider packages.
//      * @return list of provider packages.
//      */
//     public List<String> getProviderPackages() {
//         return Collections.unmodifiableList(providerPackages);
//     }
// 
//     /**
//      * Adds a provider package to the list.
//      * @param providerPackage the provider package to add.
//      */
//     public void addProviderPackage(final String providerPackage) {
//         providerPackages.add(providerPackage);
//     }
// 
// }


// Path: croquet-core/src/main/java/com/metrink/croquet/inject/CroquetRestModule.java
import com.google.inject.AbstractModule;
import com.metrink.croquet.AbstractSettings;
import com.metrink.croquet.RestSettings;

package com.metrink.croquet.inject;


/**
 * Croquet's Guice module that configures most of the dependencies.
 * @param <T> the subclass type of the settings instance
 */
public class CroquetRestModule<T extends RestSettings> extends AbstractModule {

    private final T settings;
    private Class<T> clazz;

    /**
     * Constructor for the CroquetModule.
     * @param clazz the settings base class.
     * @param settings the settings.
     */
    public CroquetRestModule(final Class<T> clazz, final T settings) {
        this.clazz = clazz;
        this.settings = settings;
    }

    @Override
    protected void configure() {
        // bind the settings classes
        bind(AbstractSettings.class).toInstance(settings);