org.springframework.data.mongodb

Interface CodecRegistryProvider

    • Method Detail

      • getCodecRegistry

        org.bson.codecs.configuration.CodecRegistry getCodecRegistry()
        Get the underlying CodecRegistry used by the MongoDB Java driver.
        Returns:
        never null.
        Throws:
        IllegalStateException - if CodecRegistry cannot be obtained.
      • hasCodecFor

        default boolean hasCodecFor(Class<?> type)
        Checks if a Codec is registered for a given type.
        Parameters:
        type - must not be null.
        Returns:
        true if getCodecRegistry() holds a Codec for given type.
        Throws:
        IllegalStateException - if CodecRegistry cannot be obtained.
      • getCodecFor

        default <T> Optional<org.bson.codecs.Codec<T>> getCodecFor(Class<T> type)
        Get the Codec registered for the given type or an empty Optional instead.
        Type Parameters:
        T -
        Parameters:
        type - must not be null.
        Returns:
        never null.
        Throws:
        IllegalArgumentException - if type is null.