Class DatabaseConfig

java.lang.Object
org.dbunit.database.DatabaseConfig

public class DatabaseConfig extends Object
Configuration used by the DatabaseConnection.
Since:
2.0
Version:
$Revision$ $Date$
Author:
manuel.laflamme, gommma (gommma AT users.sourceforge.net), Last changed by: $Author$
  • Field Details

  • Constructor Details

    • DatabaseConfig

      public DatabaseConfig()
  • Method Details

    • getConfigurator

      protected DatabaseConfig.Configurator getConfigurator()
      Returns:
      The configurator of this database config
    • setFeature

      public void setFeature(String name, boolean value)
      Deprecated.
      since 2.4.7 Use the setProperty(String, Object) also for features
      Set the value of a feature flag.
      Parameters:
      name - the feature id
      value - the feature status
    • getFeature

      public boolean getFeature(String name)
      Deprecated.
      since 2.4.7 Use the getProperty(String) where features are listed now as well
      Look up the value of a feature flag.
      Parameters:
      name - the feature id
      Returns:
      the feature status
    • setProperty

      public void setProperty(String name, Object value)
      Set the value of a property.
      Parameters:
      name - the property id
      value - the property value
    • getProperty

      public Object getProperty(String name)
      Look up the value of a property.
      Parameters:
      name - the property id
      Returns:
      the property value
    • checkObjectAllowed

      protected void checkObjectAllowed(String property, Object value)
      Checks whether the given value has the correct java type for the given property. If the value is not allowed for the given property an IllegalArgumentException is thrown.
      Parameters:
      property - The property to be set
      value - The value to which the property should be set
    • setPropertiesByString

      public void setPropertiesByString(Properties stringProperties) throws DatabaseUnitException
      Sets the given properties on the DatabaseConfig instance using the given String values. This is useful to set properties configured as strings by a build tool like ant or maven. If the required property type is an object it uses reflection to create an instance of the class specified as string.
      Parameters:
      stringProperties - The properties as strings. The key of the properties can be either the long or the short name.
      Throws:
      DatabaseUnitException
    • findByName

      public static final DatabaseConfig.ConfigProperty findByName(String property)
      Searches the DatabaseConfig.ConfigProperty object for the property with the given name
      Parameters:
      property - The property for which the enumerated object should be resolved
      Returns:
      The property object or null if it was not found.
    • findByShortName

      public static final DatabaseConfig.ConfigProperty findByShortName(String propShortName)
      Searches the DatabaseConfig.ConfigProperty object for the property with the given name
      Parameters:
      propShortName - The property short name for which the enumerated object should be resolved. Example: the short name of "http://www.dbunit.org/properties/fetchSize" is fetchSize which is the last part of the fully qualified URL.
      Returns:
      The property object or null if it was not found.
    • toString

      public String toString()
      Overrides:
      toString in class Object