PartialTransformerDefinition
Allows customization of io.scalaland.chimney.PartialTransformer derivation.
Type parameters
- Flags
-
type-level encoded flags
- From
-
type of input value
- Overrides
-
type-level encoded config
- To
-
type of output value
Attributes
- Since
-
0.7.0
- Graph
-
- Supertypes
-
trait WithRuntimeDataStoreclass Objecttrait Matchableclass Any
Members list
Value members
Concrete methods
Build Partial Transformer using current configuration.
Build Partial Transformer using current configuration.
It runs macro that tries to derive instance of PartialTransformer[From, To]
. When transformation can't be derived, it results with compilation error.
Attributes
- Returns
-
io.scalaland.chimney.PartialTransformer type class instance
- Since
-
0.7.0
Use f
instead of the primary constructor to construct the To
value.
Use f
instead of the primary constructor to construct the To
value.
Macro will read the names of Eta-expanded method's/lambda's parameters and try to match them with From
getters.
Values for each parameter can be provided the same way as if they were normal constructor's arguments.
Type parameters
- Ctor
-
type of the Eta-expanded method/lambda which should return
To
Value parameters
- f
-
method name or lambda which constructs
To
Attributes
- Returns
- See also
- Since
-
0.8.4
Use f
instead of the primary constructor to parse into Either[String, To]
value.
Use f
instead of the primary constructor to parse into Either[String, To]
value.
Macro will read the names of Eta-expanded method's/lambda's parameters and try to match them with From
getters.
Values for each parameter can be provided the same way as if they were normal constructor's arguments.
Type parameters
- Ctor
-
type of the Eta-expanded method/lambda which should return
Either[String, To]
Value parameters
- f
-
method name or lambda which constructs
Either[String, To]
Attributes
- Returns
- See also
- Since
-
1.0.0
Use f
instead of the primary constructor to parse into partial.Result[To]
value.
Use f
instead of the primary constructor to parse into partial.Result[To]
value.
Macro will read the names of Eta-expanded method's/lambda's parameters and try to match them with From
getters.
Values for each parameter can be provided the same way as if they were normal constructor's arguments.
Type parameters
- Ctor
-
type of the Eta-expanded method/lambda which should return
partial.Result[To]
Value parameters
- f
-
method name or lambda which constructs
partial.Result[To]
Attributes
- Returns
- See also
- Since
-
0.8.4
Alias to withSealedSubtypeHandled.
Alias to withSealedSubtypeHandledPartial.
Use function f
to compute value of field picked using selector
.
Use function f
to compute value of field picked using selector
.
By default if From
is missing field picked by selector
compilation fails.
Type parameters
- T
-
type of target field
- U
-
type of computed value
Value parameters
- f
-
function used to compute value of the target field
- selector
-
target field in
To
, defined like_.name
Attributes
- Returns
- See also
- Since
-
0.7.0
Use function f
to compute partial result for field picked using selector
.
Use function f
to compute partial result for field picked using selector
.
By default if From
is missing field picked by selector
compilation fails.
Type parameters
- T
-
type of target field
- U
-
type of computed value
Value parameters
- f
-
function used to compute value of the target field
- selector
-
target field in
To
, defined like_.name
Attributes
- Returns
- See also
- Since
-
0.7.0
Use provided value
for field picked using selector
.
Use provided value
for field picked using selector
.
By default if From
is missing field picked by selector
, compilation fails.
Type parameters
- T
-
type of target field
- U
-
type of provided value
Value parameters
- selector
-
target field in
To
, defined like_.name
- value
-
constant value to use for the target field
Attributes
- Returns
- See also
- Since
-
0.7.0
Use provided partial result value
for field picked using selector
.
Use provided partial result value
for field picked using selector
.
By default if From
is missing field picked by selector
, compilation fails.
Type parameters
- T
-
type of target field
- U
-
type of computed value
Value parameters
- selector
-
target field in
To
, defined like_.name
- value
-
constant value to use for the target field
Attributes
- Returns
- See also
- Since
-
0.7.0
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.
Type parameters
- T
-
type of source field
- U
-
type of target field
Value parameters
- selectorFrom
-
source field in
From
, defined like_.originalName
- selectorTo
-
target field in
To
, defined like_.newName
Attributes
- Returns
- See also
- Since
-
0.7.0
Use f
to calculate the unmatched subtype when mapping one sealed/enum into another.
Use f
to calculate the unmatched subtype when mapping one sealed/enum 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.
For convenience/readability withEnumCaseHandled alias can be used (e.g. for Scala 3 enums or Java enums).
It differs from withFieldComputed(_.matching[Subtype], src => ...)
, since withSealedSubtypeHandled
matches on From
subtype, while .matching[Subtype]
matches on To
value's piece.
Type parameters
- Subtype
-
type of sealed/enum instance
Value parameters
- f
-
function to calculate values of components that cannot be mapped automatically
Attributes
- Returns
- See also
- Since
-
1.0.0
Use f
to calculate the unmatched subtype's partial.Result when mapping one sealed/enum into another.
Use f
to calculate the unmatched subtype's partial.Result when mapping one sealed/enum 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.
For convenience/readability withEnumCaseHandledPartial alias can be used (e.g. for Scala 3 enums or Java enums).
It differs from withFieldComputedPartial(_.matching[Subtype], src => ...)
, since withSealedSubtypeHandled
matches on From
subtype, while .matching[Subtype]
matches on To
value's piece.
Type parameters
- Subtype
-
type of sealed/enum instance
Value parameters
- f
-
function to calculate values of components that cannot be mapped automatically
Attributes
- Returns
- See also
- Since
-
1.0.0
Deprecated methods
Renamed to withSealedSubtypeHandled.
Renamed to withSealedSubtypeHandledPartial.
Inherited methods
Disable Java Beans naming convention (.getName
, .isName
) on From
.
Disable Java Beans naming convention (.getName
, .isName
) on From
.
Attributes
- See also
- Since
-
0.6.0
- Inherited from:
- TransformerFlagsDsl (hidden)
Disable Java Beans naming convention (.setName(value)
) on To
.
Disable Java Beans naming convention (.setName(value)
) on To
.
Attributes
- See also
- Since
-
0.6.0
- Inherited from:
- TransformerFlagsDsl (hidden)
Disable any custom way of comparing if source fields' names and target fields' names are matching.
Disable any custom way of comparing if source fields' names and target fields' names are matching.
Attributes
- See also
- Since
-
1.0.0
- Inherited from:
- TransformerFlagsDsl (hidden)
Disable any custom way of comparing if source subtypes' names and target fields' names are matching.
Disable any custom way of comparing if source subtypes' names and target fields' names are matching.
Attributes
- See also
- Since
-
1.0.0
- Inherited from:
- TransformerFlagsDsl (hidden)
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.
Attributes
- See also
- Since
-
0.1.9
- Inherited from:
- TransformerFlagsDsl (hidden)
Disable not failing compilation on unresolved Java Beans naming convention (.setName(value)
) in To
.
Disable not failing compilation on unresolved Java Beans naming convention (.setName(value)
) in To
.
Attributes
- See also
- Since
-
0.8.3
- Inherited from:
- TransformerFlagsDsl (hidden)
Disable any implicit conflict resolution preference that was set previously.
Disable any implicit conflict resolution preference that was set previously.
Attributes
- See also
- Since
-
0.7.0
- Inherited from:
- TransformerFlagsDsl (hidden)
Disable inherited accessors lookup that was previously enabled by enableInheritedAccessors
Disable inherited accessors lookup that was previously enabled by enableInheritedAccessors
Attributes
- See also
- Since
-
0.8.0
- Inherited from:
- TransformerFlagsDsl (hidden)
Disable printing the logs from the derivation process.
Disable printing the logs from the derivation process.
Attributes
- See also
-
https://chimney.readthedocs.io/troubleshooting/#debugging-macros for more details
- Since
-
0.8.0
- Inherited from:
- TransformerFlagsDsl (hidden)
Disable method accessors lookup that was previously enabled by enableMethodAccessors
Disable method accessors lookup that was previously enabled by enableMethodAccessors
Attributes
- See also
- Since
-
0.5.0
- Inherited from:
- TransformerFlagsDsl (hidden)
Enable calling unary non-Unit methods with Java Beans naming convention (.setName(value)
) in To
.
Enable calling unary non-Unit methods with Java Beans naming convention (.setName(value)
) in To
.
Attributes
- See also
- Since
-
1.0.0
- Inherited from:
- TransformerFlagsDsl (hidden)
Disable None
fallback value for optional fields in To
.
Disable None
fallback value for optional fields in To
.
Attributes
- See also
- Since
-
0.6.0
- Inherited from:
- TransformerFlagsDsl (hidden)
Disable safe Option
unwrapping by PartialTransformer
- each Option
to non-Option` has to be handled manually.
Disable safe Option
unwrapping by PartialTransformer
- each Option
to non-Option` has to be handled manually.
Attributes
- See also
- Since
-
1.0.0
- Inherited from:
- TransformerFlagsDsl (hidden)
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.
Attributes
- See also
- Since
-
0.2.1
- Inherited from:
- TransformerFlagsDsl (hidden)
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.
Attributes
- See also
- Since
-
0.2.1
- Inherited from:
- TransformerFlagsDsl (hidden)
Enable custom way of comparing if source fields' names and target fields' names are matching.
Enable custom way of comparing if source fields' names and target fields' names are matching.
Value parameters
- namesComparison
-
parameter specifying how names should be compared by macro
Attributes
- See also
- Since
-
1.0.0
- Inherited from:
- TransformerFlagsDsl (hidden)
Enable custom way of comparing if source subtypes' names and target fields' names are matching.
Enable custom way of comparing if source subtypes' names and target fields' names are matching.
Value parameters
- namesComparison
-
parameter specifying how names should be compared by macro
Attributes
- See also
- Since
-
1.0.0
- Inherited from:
- TransformerFlagsDsl (hidden)
Enable fallback to default case class values in To
type.
Enable fallback to default case class values in To
type.
By default in such case derivation will fail. By enabling this flag, derivation will fallback to default value.
Attributes
- See also
- Since
-
0.6.0
- Inherited from:
- TransformerFlagsDsl (hidden)
Enable not failing compilation on unresolved Java Beans naming convention (.setName(value)
) in To
.
Enable not failing compilation on unresolved Java Beans naming convention (.setName(value)
) in To
.
By default presence of setters (.setName(value)
) fails compilation unless setters are enabled and matched with a source field or provided valued.
Attributes
- See also
- Since
-
0.8.3
- Inherited from:
- TransformerFlagsDsl (hidden)
Enable conflict resolution when both Transformer
and PartialTransformer
are available in the implicit scope.
Enable conflict resolution when both Transformer
and PartialTransformer
are available in the implicit scope.
Value parameters
- preference
-
parameter specifying which implicit transformer to pick in case of conflict
Attributes
- See also
- Since
-
0.7.0
- Inherited from:
- TransformerFlagsDsl (hidden)
Enable lookup in definitions inherited from supertype.
Enable lookup in definitions inherited from supertype.
By default only values defined directly in the type are considered. With this flag supertype methods would not be filtered out
Attributes
- See also
- Since
-
0.8.0
- Inherited from:
- TransformerFlagsDsl (hidden)
Enable printing the logs from the derivation process.
Enable printing the logs from the derivation process.
Attributes
- See also
-
https://chimney.readthedocs.io/troubleshooting/#debugging-macros for more details
- Since
-
0.8.0
- Inherited from:
- TransformerFlagsDsl (hidden)
Enable values to be supplied from method calls. Source method must be public and have no parameter list.
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)
Attributes
- See also
- Since
-
0.6.0
- Inherited from:
- TransformerFlagsDsl (hidden)
Enable calling unary non-Unit methods with Java Beans naming convention (.setName(value)
) in To
.
Enable calling unary non-Unit methods with Java Beans naming convention (.setName(value)
) in To
.
By default only methods returning Unit
(setName(value): Unit
) could be considered setters.
Attributes
- See also
- Since
-
1.0.0
- Inherited from:
- TransformerFlagsDsl (hidden)
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.
Attributes
- See also
- Since
-
0.2.1
- Inherited from:
- TransformerFlagsDsl (hidden)
Enable safe Option unwrapping by PartialTransformer
- Option
is automatically unwrapped to non-Option
values, None
is treated as empty value errors.
Enable safe Option unwrapping by PartialTransformer
- Option
is automatically unwrapped to non-Option
values, None
is treated as empty value errors.
This is the default behavior.
Attributes
- See also
- Since
-
1.0.0
- Inherited from:
- TransformerFlagsDsl (hidden)
Concrete fields
runtime storage for values and functions that transformer definition is customized with
runtime storage for values and functions that transformer definition is customized with