Class

io.scalaland.chimney.dsl

TransformerDefinition

Related Doc: package dsl

Permalink

final class TransformerDefinition[From, To, C <: TransformerCfg] extends ConfigDsl[[C1]TransformerDefinition[From, To, C1], C]

Allows customization of io.scalaland.chimney.Transformer derivation

From

type of input value

To

type of output value

C

type-level encoded config

Linear Supertypes
ConfigDsl[[C1]TransformerDefinition[From, To, C1], C], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TransformerDefinition
  2. ConfigDsl
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new TransformerDefinition(overrides: Map[String, Any], instances: Map[(String, String), Any])

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def __addInstance(from: String, to: String, value: Any): TransformerDefinition[From, To, C]

    Permalink

    Used internally by macro.

    Used internally by macro. Please don't use in your code.

  5. def __addOverride(key: String, value: Any): TransformerDefinition[From, To, C]

    Permalink

    Used internally by macro.

    Used internally by macro. Please don't use in your code.

  6. def __refineConfig[C1 <: TransformerCfg]: TransformerDefinition[From, To, C1]

    Permalink

    Used internally by macro.

    Used internally by macro. Please don't use in your code.

  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. macro def buildTransformer: Transformer[From, To]

    Permalink

    Build Transformer using current configuration.

    Build Transformer using current configuration.

    It runs macro that tries to derive instance of Transformer[From, To]. When transformation can't be derived, it results with compilation error.

    returns

    io.scalaland.chimney.Transformer type class instance

  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @throws( ... )
  10. def disableDefaultValues: TransformerDefinition[From, To, DisableDefaultValues[C]]

    Permalink

    Fail derivation if From type is missing field even if To has default value for it.

    Fail derivation if From type is missing field even if To has default value for it.

    By default in such case derivation will fallback to default values.

    Definition Classes
    ConfigDsl
    See also

    https://scalalandio.github.io/chimney/transformers/default-values.html#disabling-default-values-in-generated-transformer for more details

  11. def enableBeanGetters: TransformerDefinition[From, To, EnableBeanGetters[C]]

    Permalink

    Enable Java Beans naming convention (.getName, .isName) on From.

    Enable Java Beans naming convention (.getName, .isName) on From.

    By default only Scala conversions (.name) are allowed.

    Definition Classes
    ConfigDsl
    See also

    https://scalalandio.github.io/chimney/transformers/java-beans.html#reading-from-java-beans for more details

  12. def enableBeanSetters: TransformerDefinition[From, To, EnableBeanSetters[C]]

    Permalink

    Enable Java Beans naming convention (.setName(value)) on To.

    Enable Java Beans naming convention (.setName(value)) on To.

    By default only Scala conversions (.copy(name = value)) are allowed.

    Definition Classes
    ConfigDsl
    See also

    https://scalalandio.github.io/chimney/transformers/java-beans.html#writing-to-java-beans for more details

  13. def enableMethodAccessors: TransformerDefinition[From, To, EnableMethodAccessors[C]]

    Permalink

    Enable values to be supplied from method calls.

    Enable values to be supplied from method calls. Source method must be public and have no parameter list.

    By default this is disabled because method calls may perform side effects (e.g. mutations)

    Definition Classes
    ConfigDsl
    See also

    https://scalalandio.github.io/chimney/transformers/customizing-transformers.html#using-method-accessors for more details

  14. def enableOptionDefaultsToNone: TransformerDefinition[From, To, EnableOptionDefaultsToNone[C]]

    Permalink

    Sets target value of optional field to None if field is missing from source type From.

    Sets target value of optional field to None if field is missing from source type From.

    By default in such case compilation fails.

    Definition Classes
    ConfigDsl
    See also

    https://scalalandio.github.io/chimney/transformers/default-values.html#default-values-for-option-fields for more details

  15. def enableUnsafeOption: TransformerDefinition[From, To, EnableUnsafeOption[C]]

    Permalink

    Enable unsafe call to .get when source type From contains field of type Option[A], but target type To defines this fields as A.

    Enable unsafe call to .get when source type From contains field of type Option[A], but target type To defines this fields as A.

    It's unsafe as code generated this way may throw at runtime.

    By default in such case compilation fails.

    Definition Classes
    ConfigDsl
    See also

    https://scalalandio.github.io/chimney/transformers/unsafe-options.html for more details

  16. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  18. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  19. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  20. val instances: Map[(String, String), Any]

    Permalink
  21. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  22. def lift[F[+_]]: TransformerFDefinition[F, From, To, WrapperType[F, C]]

    Permalink

    Lifts current transformer definition with provided type constructor F.

    Lifts current transformer definition with provided type constructor F.

    It keeps all the configuration, provided missing values, renames, coproduct instances etc.

    F

    wrapper type constructor

    returns

    io.scalaland.chimney.dsl.TransformerFDefinition

  23. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  24. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  25. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  26. val overrides: Map[String, Any]

    Permalink
  27. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  28. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  29. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. macro def withCoproductInstance[Inst](f: (Inst) ⇒ To): TransformerDefinition[From, To, _ <: TransformerCfg]

    Permalink

    Use f to calculate the (missing) coproduct instance when mapping one coproduct into another.

    Use f to calculate the (missing) coproduct instance when mapping one coproduct into another.

    By default if mapping one coproduct in From into another coproduct in To derivation expects that coproducts to have matching names of its components, and for every component in To field's type there is matching component in From type. If some component is missing it fails compilation unless provided replacement with this operation.

    f

    function to calculate values of components that cannot be mapped automatically

    returns

    io.scalaland.chimney.dsl.TransformerDefinition

    See also

    https://scalalandio.github.io/chimney/transformers/customizing-transformers.html#transforming-coproducts for more details

  33. macro def withCoproductInstanceF[F[+_], Inst](f: (Inst) ⇒ F[To]): TransformerFDefinition[F, From, To, _ <: TransformerCfg]

    Permalink

    Use f to calculate the (missing) wrapped coproduct instance when mapping one coproduct into another

    Use f to calculate the (missing) wrapped coproduct instance when mapping one coproduct into another

    By default if mapping one coproduct in From into another coproduct in To derivation expects that coproducts to have matching names of its components, and for every component in To field's type there is matching component in From type. If some component is missing it fails compilation unless provided replacement with this operation.

    f

    function to calculate values of components that cannot be mapped automatically

    returns

    io.scalaland.chimney.dsl.TransformerFDefinition

    See also

    https://scalalandio.github.io/chimney/transformers/customizing-transformers.html#transforming-coproducts for more details

  34. macro def withFieldComputed[T, U](selector: (To) ⇒ T, map: (From) ⇒ U): TransformerDefinition[From, To, _ <: TransformerCfg]

    Permalink

    Use map provided here to compute value of field picked using selector.

    Use map provided here to compute value of field picked using selector.

    By default if From is missing field picked by selector compilation fails.

    selector

    target field in To, defined like _.name

    map

    function used to compute value of the target field

    returns

    io.scalaland.chimney.dsl.TransformerDefinition

    See also

    https://scalalandio.github.io/chimney/transformers/customizing-transformers.html#providing-missing-values for more details

  35. macro def withFieldComputedF[F[+_], T, U](selector: (To) ⇒ T, map: (From) ⇒ F[U]): TransformerFDefinition[F, From, To, _ <: TransformerCfg]

    Permalink

    Use map provided here to compute wrapped value of field picked using selector.

    Use map provided here to compute wrapped value of field picked using selector.

    By default if From is missing field picked by selector compilation fails.

    selector

    target field in To, defined like _.name

    map

    function used to compute value of the target field

    returns

    io.scalaland.chimney.dsl.TransformerFDefinition

    See also

    https://scalalandio.github.io/chimney/transformers/customizing-transformers.html#providing-missing-values for more details

  36. macro def withFieldConst[T, U](selector: (To) ⇒ T, value: U): TransformerDefinition[From, To, _ <: TransformerCfg]

    Permalink

    Use value provided here for field picked using selector.

    Use value provided here for field picked using selector.

    By default if From is missing field picked by selector compilation fails.

    selector

    target field in To, defined like _.name

    value

    constant value to use for the target field

    returns

    io.scalaland.chimney.dsl.TransformerDefinition

    See also

    https://scalalandio.github.io/chimney/transformers/customizing-transformers.html#providing-missing-values for more details

  37. macro def withFieldConstF[F[+_], T, U](selector: (To) ⇒ T, value: F[U]): TransformerFDefinition[F, From, To, _ <: TransformerCfg]

    Permalink

    Use wrapped value provided here for field picked using selector.

    Use wrapped value provided here for field picked using selector.

    By default if From is missing field picked by selector compilation fails.

    selector

    target field in To, defined like _.name

    value

    constant value to use for the target field

    returns

    io.scalaland.chimney.dsl.TransformerFDefinition

    See also

    https://scalalandio.github.io/chimney/transformers/customizing-transformers.html#providing-missing-values for more details

  38. macro def withFieldRenamed[T, U](selectorFrom: (From) ⇒ T, selectorTo: (To) ⇒ U): TransformerDefinition[From, To, _ <: TransformerCfg]

    Permalink

    Use selectorFrom field in From to obtain the value of selectorTo field in To

    Use selectorFrom field in From to obtain the value of selectorTo field in To

    By default if From is missing field picked by selectorTo compilation fails.

    selectorFrom

    source field in From, defined like _.originalName

    selectorTo

    target field in To, defined like _.newName

    returns

    io.scalaland.chimney.dsl.TransformerDefinition

    See also

    https://scalalandio.github.io/chimney/transformers/customizing-transformers.html#fields-renaming for more details

Deprecated Value Members

  1. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from ConfigDsl[[C1]TransformerDefinition[From, To, C1], C]

Inherited from AnyRef

Inherited from Any

Ungrouped