org.dbmaintain.config
Class ConfigUtils

java.lang.Object
  extended by org.dbmaintain.config.ConfigUtils

public class ConfigUtils
extends Object

Class containing configuration related utilities

Author:
Filip Neven, Tim Ducheyne

Constructor Summary
ConfigUtils()
           
 
Method Summary
static
<T> Class<T>
getConfiguredClass(Class<T> type, Properties configuration, String... implementationDiscriminatorValues)
          Retrieves the concrete instance of the class with the given type as configured by the given Configuration.
static
<T> Class<T>
getFactoryClass(Class<T> type, Properties configuration, String... implementationDiscriminatorValues)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigUtils

public ConfigUtils()
Method Detail

getConfiguredClass

public static <T> Class<T> getConfiguredClass(Class<T> type,
                                              Properties configuration,
                                              String... implementationDiscriminatorValues)
Retrieves the concrete instance of the class with the given type as configured by the given Configuration. Tries to retrieve a specific implementation first (propery key = fully qualified name of the interface type + '.impl.className.' + implementationDiscriminatorValue). If this key does not exist, the generally configured instance is retrieved (same property key without the implementationDiscriminatorValue).

Parameters:
type - The type of the instance
configuration - The configuration containing the necessary properties for configuring the instance
implementationDiscriminatorValues - The values that define which specific implementation class should be used. This is typically an environment specific property, like the DBMS that is used.
Returns:
The configured class name

getFactoryClass

public static <T> Class<T> getFactoryClass(Class<T> type,
                                           Properties configuration,
                                           String... implementationDiscriminatorValues)


Copyright © 2011. All Rights Reserved.