-
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
AdbaDataSourceProperty
public interface DataSourceProperty extends java.io.Serializable
An attribute of aDataSource
that can be configured to influence itsDataSource
s. TheDataSource.Builder.property(jdk.incubator.sql2.DataSourceProperty, java.lang.Object)
method is used to set the values ofDataSource
properties. Implementations must be thread safe.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
configure(DataSource ds, java.lang.Object value)
java.lang.Object
defaultValue()
Return the value for this property to use if no other value is set.boolean
isSensitive()
Returns true if thisDataSourceProperty
is contains sensitive information such as a password or encryption key.java.lang.String
name()
Return the name of thisDataSourceProperty
.java.lang.Class<?>
range()
Return the type of the value of thisDataSourceProperty
.default boolean
validate(java.lang.Object value)
Determine whether a value is valid for thisDataSourceProperty
.
-
-
-
Method Detail
-
name
java.lang.String name()
Return the name of thisDataSourceProperty
.- Returns:
- the name of this
DataSourceProperty
-
range
java.lang.Class<?> range()
Return the type of the value of thisDataSourceProperty
. Any value set for this property must be assignable to this type.- Returns:
- the type of the values of this
DataSourceProperty
-
validate
default boolean validate(java.lang.Object value)
Determine whether a value is valid for thisDataSourceProperty
. Returnstrue
ifvalue
is valid andfalse
otherwise.- Parameters:
value
- a value for thisDataSourceProperty
- Returns:
true
iffvalue
is valid for thisDataSourceProperty
-
defaultValue
java.lang.Object defaultValue()
Return the value for this property to use if no other value is set. This has no meaning for user defined properties as the implementation is not aware of the the existence of the property. Default values are used for standard and implementation defined properties.- Returns:
- the default value or
null
if there is no default value
-
isSensitive
boolean isSensitive()
Returns true if thisDataSourceProperty
is contains sensitive information such as a password or encryption key.- Returns:
- true iff this is sensitive
-
configure
default void configure(DataSource ds, java.lang.Object value)
Configure theDataSource
as appropriate for the givenvalue
of thisDataSourceProperty
. This is primarily for the use of user defined properties.- Parameters:
ds
- theDataSource
to configurevalue
- the value of this property
-
-