Class AbstractMongoConfiguration

java.lang.Object
io.micronaut.configuration.mongo.core.AbstractMongoConfiguration
Direct Known Subclasses:
DefaultMongoConfiguration, NamedMongoConfiguration

public abstract class AbstractMongoConfiguration extends Object
Abstract Mongo configuration type.
Since:
1.0
Author:
graemerocher
  • Constructor Details

    • AbstractMongoConfiguration

      protected AbstractMongoConfiguration(io.micronaut.runtime.ApplicationConfiguration applicationConfiguration)
      Constructor.
      Parameters:
      applicationConfiguration - applicationConfiguration
  • Method Details

    • codecs

      public void codecs(List<org.bson.codecs.Codec<?>> codecList)
      Additional codecs to register.
      Parameters:
      codecList - The list of codecs
    • codecRegistries

      public void codecRegistries(List<org.bson.codecs.configuration.CodecRegistry> codecRegistries)
      Additional codecs to register.
      Parameters:
      codecRegistries - The list of codecs
    • commandListeners

      public void commandListeners(List<com.mongodb.event.CommandListener> commandListeners)
      Additional command listeners to register.
      Parameters:
      commandListeners - The list of command listeners
    • connectionPoolListeners

      public void connectionPoolListeners(List<com.mongodb.event.ConnectionPoolListener> connectionPoolListeners)
      Additional command listeners to register.
      Parameters:
      connectionPoolListeners - The list of command listeners
    • packages

      public void packages(Collection<String> packageNames)
      Additional codecs to register.
      Parameters:
      packageNames - The package names
    • getCodecs

      public List<org.bson.codecs.Codec<?>> getCodecs()
      The configured codecs.
      Returns:
      The codecs
    • getCodecRegistries

      public List<org.bson.codecs.configuration.CodecRegistry> getCodecRegistries()
      The configured codec registries.
      Returns:
      The registries
    • getCommandListeners

      public List<com.mongodb.event.CommandListener> getCommandListeners()
      The configured command listeners.
      Returns:
      The command listeners
    • getConnectionPoolListeners

      public List<com.mongodb.event.ConnectionPoolListener> getConnectionPoolListeners()
      The configured connection pool listeners.
      Returns:
      The connection pool listeners
    • getUri

      @NotBlank public @NotBlank String getUri()
      Returns:
      The MongoDB URI
    • setUri

      public void setUri(String uri)
      Sets the MongoDB URI.
      Parameters:
      uri - The MongoDB URI
    • setPackageNames

      public void setPackageNames(Collection<String> packageNames)
      The package names to allow for POJOs.
      Parameters:
      packageNames - The package names
    • getPackageNames

      public Collection<String> getPackageNames()
      Returns:
      The package names to allow for POJOs.
    • setAutomaticClassModels

      public void setAutomaticClassModels(boolean automaticClassModels)
      Whether to allow automatic class models (defaults to true).
      Parameters:
      automaticClassModels - True if automatic class models should be allowed
    • isAutomaticClassModels

      public boolean isAutomaticClassModels()
      Returns:
      Whether to allow automatic class models (defaults to true).
    • getConnectionString

      public Optional<com.mongodb.ConnectionString> getConnectionString()
      Returns:
      The MongoDB ConnectionString
    • getClusterSettings

      public abstract com.mongodb.connection.ClusterSettings.Builder getClusterSettings()
      Returns:
      The ClusterSettings.builder()
    • getClientSettings

      public abstract com.mongodb.MongoClientSettings.Builder getClientSettings()
      Returns:
      The MongoClientSettings.builder()
    • getServerSettings

      public abstract com.mongodb.connection.ServerSettings.Builder getServerSettings()
      Returns:
      The ServerSettings.builder()
    • getPoolSettings

      public abstract com.mongodb.connection.ConnectionPoolSettings.Builder getPoolSettings()
      Returns:
      The ConnectionPoolSettings.builder()
    • getSocketSettings

      public abstract com.mongodb.connection.SocketSettings.Builder getSocketSettings()
      Returns:
      The SocketSettings.builder()
    • getSslSettings

      public abstract com.mongodb.connection.SslSettings.Builder getSslSettings()
      Returns:
      The SslSettings.builder()
    • buildSettings

      public com.mongodb.MongoClientSettings buildSettings()
      Returns:
      Builds the MongoClientSettings
    • addDefaultCodecRegistry

      protected void addDefaultCodecRegistry(List<org.bson.codecs.configuration.CodecRegistry> codecRegistries)
      Adds the default codec registry.
      Parameters:
      codecRegistries - The codec registries
    • setCodecRegistryBuilder

      public void setCodecRegistryBuilder(CodecRegistryBuilder codecRegistryBuilder)
      Parameters:
      codecRegistryBuilder - The builder
    • getApplicationName

      protected String getApplicationName()
      Return the appplication name or a default name.
      Returns:
      applicationName
    • isUseSerde

      public boolean isUseSerde()
      Returns:
      useSerde
    • setUseSerde

      public void setUseSerde(boolean useSerde)
      Activates Micronaut Serialization instead of MongoDB POJO.
      Parameters:
      useSerde - true if to activate