Package org.springframework.boot.jdbc
Enum EmbeddedDatabaseConnection
- java.lang.Object
- java.lang.Enum<EmbeddedDatabaseConnection>
- org.springframework.boot.jdbc.EmbeddedDatabaseConnection
- All Implemented Interfaces:
Serializable
,Comparable<EmbeddedDatabaseConnection>
public enum EmbeddedDatabaseConnection extends Enum<EmbeddedDatabaseConnection>
Connection details forembedded databases
.- See Also:
get(ClassLoader)
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EmbeddedDatabaseConnection
get(ClassLoader classLoader)
Returns the most suitableEmbeddedDatabaseConnection
for the given class loader.String
getDriverClassName()
Returns the driver class name.org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType
getType()
Returns theEmbeddedDatabaseType
for the connection.String
getUrl(String databaseName)
Returns the URL for the connection using the specifieddatabaseName
.static boolean
isEmbedded(String driverClass)
Convenience method to determine if a given driver class name represents an embedded database type.static boolean
isEmbedded(DataSource dataSource)
Convenience method to determine if a given data source represents an embedded database type.static EmbeddedDatabaseConnection
valueOf(String name)
Returns the enum constant of this type with the specified name.static EmbeddedDatabaseConnection[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
Enum Constant Detail
NONE
public static final EmbeddedDatabaseConnection NONE
No Connection.
H2
public static final EmbeddedDatabaseConnection H2
H2 Database Connection.
DERBY
public static final EmbeddedDatabaseConnection DERBY
Derby Database Connection.
HSQL
public static final EmbeddedDatabaseConnection HSQL
HSQL Database Connection.
Method Detail
values
public static EmbeddedDatabaseConnection[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (EmbeddedDatabaseConnection c : EmbeddedDatabaseConnection.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
valueOf
public static EmbeddedDatabaseConnection valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
getDriverClassName
public String getDriverClassName()
Returns the driver class name.- Returns:
- the driver class name
getType
public org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType getType()
Returns theEmbeddedDatabaseType
for the connection.- Returns:
- the database type
getUrl
public String getUrl(String databaseName)
Returns the URL for the connection using the specifieddatabaseName
.- Parameters:
databaseName
- the name of the database- Returns:
- the connection URL
isEmbedded
public static boolean isEmbedded(String driverClass)
Convenience method to determine if a given driver class name represents an embedded database type.- Parameters:
driverClass
- the driver class- Returns:
- true if the driver class is one of the embedded types
isEmbedded
public static boolean isEmbedded(DataSource dataSource)
Convenience method to determine if a given data source represents an embedded database type.- Parameters:
dataSource
- the data source to interrogate- Returns:
- true if the data source is one of the embedded types
get
public static EmbeddedDatabaseConnection get(ClassLoader classLoader)
Returns the most suitableEmbeddedDatabaseConnection
for the given class loader.- Parameters:
classLoader
- the class loader used to check for classes- Returns:
- an
EmbeddedDatabaseConnection
orNONE
.