Class ScalaCollectionConverterRegistrar

java.lang.Object
io.micronaut.scala.convert.ScalaCollectionConverterRegistrar
All Implemented Interfaces:
io.micronaut.core.convert.TypeConverterRegistrar

@Internal public final class ScalaCollectionConverterRegistrar extends Object implements io.micronaut.core.convert.TypeConverterRegistrar
Converters for Scala collection types.

Every converter into a Scala collection produces an independent copy rather than a view over the Java collection it was given. Micronaut hands these converters a container-owned collection, and a view over it would let a later mutation change the value already injected into a bean. The mutable targets copy into a mutable Scala collection, so the bean still owns something it can modify; the mutation simply does not travel back. The two Scala-to-Java converters are the deliberate exception: there the caller owns the source, and wrapping is the cheaper, expected behaviour of CollectionConverters.asJavaCollection.

  • Constructor Details

    • ScalaCollectionConverterRegistrar

      public ScalaCollectionConverterRegistrar()
  • Method Details

    • register

      public void register(io.micronaut.core.convert.MutableConversionService conversionService)
      Specified by:
      register in interface io.micronaut.core.convert.TypeConverterRegistrar