Class DefaultBasicR2dbcProperties

java.lang.Object
io.micronaut.r2dbc.DefaultBasicR2dbcProperties
All Implemented Interfaces:
io.micronaut.core.naming.Named, BasicR2dbcProperties

@EachProperty(value="r2dbc.datasources", primary="default") public class DefaultBasicR2dbcProperties extends Object implements BasicR2dbcProperties
Abstract implementation of BasicR2dbcProperties.
Since:
1.0.0
Author:
graemerocher
  • Constructor Details

    • DefaultBasicR2dbcProperties

      protected DefaultBasicR2dbcProperties(@Parameter String name, io.micronaut.context.env.Environment environment)
      Default constructor.
      Parameters:
      name - The name of the datasource
      environment - The environment
  • Method Details

    • builder

      @NonNull public io.r2dbc.spi.ConnectionFactoryOptions.Builder builder()
      Specified by:
      builder in interface BasicR2dbcProperties
      Returns:
      Return the current builder
    • setDriver

      public BasicR2dbcProperties setDriver(@NotBlank @NotBlank String driver)
      Sets the driver.
      Specified by:
      setDriver in interface BasicR2dbcProperties
      Parameters:
      driver - The driver
      Returns:
      These properties
    • setOptions

      public BasicR2dbcProperties setOptions(@MapFormat(keyFormat=RAW) @Nullable @Nullable Map<String,String> options)
      Sets the connection properties.
      Specified by:
      setOptions in interface BasicR2dbcProperties
      Parameters:
      options - The options
      Returns:
      These properties
    • setProtocol

      public BasicR2dbcProperties setProtocol(@NotBlank @NotBlank String protocol)
      Sets the protocol.
      Specified by:
      setProtocol in interface BasicR2dbcProperties
      Parameters:
      protocol - The protocol
      Returns:
      These properties
    • setConnectTimeout

      public BasicR2dbcProperties setConnectTimeout(Duration duration)
      Sets the connect timeout.
      Specified by:
      setConnectTimeout in interface BasicR2dbcProperties
      Parameters:
      duration - The duration
      Returns:
      These properties
    • setSsl

      public BasicR2dbcProperties setSsl(boolean ssl)
      Sets whether to prefer SSL configuration.
      Specified by:
      setSsl in interface BasicR2dbcProperties
      Parameters:
      ssl - Sets whether to prefer SSL
      Returns:
      These properties
    • newConnectionFactoryOptionsBuilder

      protected static io.r2dbc.spi.ConnectionFactoryOptions.Builder newConnectionFactoryOptionsBuilder(String name, io.micronaut.context.env.Environment env, @Nullable @Nullable String defaultUrl)
      Create a ConnectionFactoryOptions.Builder from the configured URL if present.
      Parameters:
      name - The name of the datasource
      env - The environment
      defaultUrl - The default URL to use
      Returns:
      The builder
    • getName

      public String getName()
      Specified by:
      getName in interface io.micronaut.core.naming.Named
    • getBuilder

      public io.r2dbc.spi.ConnectionFactoryOptions.Builder getBuilder()
      Returns:
      The connection factory options builder.
    • setHost

      public BasicR2dbcProperties setHost(@NotBlank @NotBlank String host)
      Sets the host.
      Specified by:
      setHost in interface BasicR2dbcProperties
      Parameters:
      host - The host
      Returns:
      These properties
    • setPort

      public BasicR2dbcProperties setPort(@Positive @jakarta.validation.constraints.Positive int port)
      Sets the port.
      Specified by:
      setPort in interface BasicR2dbcProperties
      Parameters:
      port - The port
      Returns:
      These properties
    • setUsername

      public BasicR2dbcProperties setUsername(@NotBlank @NotBlank String username)
      Sets the username.
      Specified by:
      setUsername in interface BasicR2dbcProperties
      Parameters:
      username - The username
      Returns:
      These properties
    • setPassword

      public BasicR2dbcProperties setPassword(CharSequence password)
      Sets the password.
      Specified by:
      setPassword in interface BasicR2dbcProperties
      Parameters:
      password - The password
      Returns:
      These properties
    • setDatabase

      public BasicR2dbcProperties setDatabase(@NotBlank @NotBlank String database)
      Sets the initial database name.
      Specified by:
      setDatabase in interface BasicR2dbcProperties
      Parameters:
      database - The database
      Returns:
      These properties