枚举 ConnectionUrl.Type
- java.lang.Object
-
- java.lang.Enum<ConnectionUrl.Type>
-
- com.mysql.cj.conf.ConnectionUrl.Type
-
- 所有已实现的接口:
Serializable,Comparable<ConnectionUrl.Type>
- 封闭类:
- ConnectionUrl
public static enum ConnectionUrl.Type extends Enum<ConnectionUrl.Type>
The database URL type which is determined by the scheme section of the connection string.
-
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 static ConnectionUrl.TypefromValue(String scheme, int n)Returns theConnectionUrl.Typecorresponding to the given scheme and number of hosts, if any.ConnectionUrl.TypegetAlternateDnsSrvType()ConnectionUrl.HostsCardinalitygetCardinality()static ConnectionUrlgetConnectionUrlInstance(ConnectionUrlParser parser, Properties info)Instantiates a class that implements the right type of connection URLs for the givenConnectionUrlParser.PropertyKeygetDnsSrvPropertyKey()StringgetImplementingClass()StringgetScheme()static booleanisSupported(String scheme)Checks if the given scheme corresponds to one of the connection types the driver supports.static ConnectionUrl.TypevalueOf(String name)返回带有指定名称的该类型的枚举常量。static ConnectionUrl.Type[]values()按照声明该枚举类型的常量的顺序, 返回 包含这些常量的数组。
-
-
-
枚举常量详细资料
-
FAILOVER_DNS_SRV_CONNECTION
public static final ConnectionUrl.Type FAILOVER_DNS_SRV_CONNECTION
-
LOADBALANCE_DNS_SRV_CONNECTION
public static final ConnectionUrl.Type LOADBALANCE_DNS_SRV_CONNECTION
-
REPLICATION_DNS_SRV_CONNECTION
public static final ConnectionUrl.Type REPLICATION_DNS_SRV_CONNECTION
-
XDEVAPI_DNS_SRV_SESSION
public static final ConnectionUrl.Type XDEVAPI_DNS_SRV_SESSION
-
SINGLE_CONNECTION
public static final ConnectionUrl.Type SINGLE_CONNECTION
-
FAILOVER_CONNECTION
public static final ConnectionUrl.Type FAILOVER_CONNECTION
-
LOADBALANCE_CONNECTION
public static final ConnectionUrl.Type LOADBALANCE_CONNECTION
-
REPLICATION_CONNECTION
public static final ConnectionUrl.Type REPLICATION_CONNECTION
-
XDEVAPI_SESSION
public static final ConnectionUrl.Type XDEVAPI_SESSION
-
-
方法详细资料
-
values
public static ConnectionUrl.Type[] values()
按照声明该枚举类型的常量的顺序, 返回 包含这些常量的数组。该方法可用于迭代 常量, 如下所示:for (ConnectionUrl.Type c : ConnectionUrl.Type.values()) System.out.println(c);
- 返回:
- 按照声明该枚举类型的常量的顺序返回的包含这些常量的数组
-
valueOf
public static ConnectionUrl.Type valueOf(String name)
返回带有指定名称的该类型的枚举常量。 字符串必须与用于声明该类型的枚举常量的 标识符完全匹配。(不允许有多余 的空格字符。)- 参数:
name- 要返回的枚举常量的名称。- 返回:
- 返回带有指定名称的枚举常量
- 抛出:
IllegalArgumentException- 如果该枚举类型没有带有指定名称的常量NullPointerException- 如果参数为空值
-
getScheme
public String getScheme()
-
getCardinality
public ConnectionUrl.HostsCardinality getCardinality()
-
getImplementingClass
public String getImplementingClass()
-
getDnsSrvPropertyKey
public PropertyKey getDnsSrvPropertyKey()
-
getAlternateDnsSrvType
public ConnectionUrl.Type getAlternateDnsSrvType()
-
fromValue
public static ConnectionUrl.Type fromValue(String scheme, int n)
Returns theConnectionUrl.Typecorresponding to the given scheme and number of hosts, if any. Otherwise throws anUnsupportedConnectionStringException. Calling this method with the argument n lower than 0 skips the hosts cardinality validation.- 参数:
scheme- one of supported schemesn- the number of hosts in the database URL- 返回:
- the
ConnectionUrl.Typecorresponding to the given protocol and number of hosts
-
getConnectionUrlInstance
public static ConnectionUrl getConnectionUrlInstance(ConnectionUrlParser parser, Properties info)
Instantiates a class that implements the right type of connection URLs for the givenConnectionUrlParser.- 参数:
parser- theConnectionUrlParsercontaining the URL components.info- a connection properties map to add to theConnectionUrlstructure.- 返回:
- an instance of
ConnectionUrl.
-
isSupported
public static boolean isSupported(String scheme)
Checks if the given scheme corresponds to one of the connection types the driver supports.- 参数:
scheme- scheme part from connection string, like "jdbc:mysql:"- 返回:
- true if the given scheme is supported by driver
-
-