PartialTransformer

io.scalaland.chimney.PartialTransformer
See thePartialTransformer companion object
@FunctionalInterface
trait PartialTransformer[From, To] extends AutoDerived[From, To]

Type class expressing partial transformation between source type From and target type To, with the ability of reporting path-annotated transformation error(s).

Type parameters

From

type of input value

To

type of output value

Attributes

See also
Since

0.7.0

Note

You should not need to instantiate this class manually, if you can derive it - take a look at io.scalaland.chimney.PartialTransformer.derive and io.scalaland.chimney.PartialTransformer.define methods for that. Manual intantiation is only necessary if you want to add support for the transformation that is not supported out of the box. Even then consult https://chimney.readthedocs.io/cookbook/#integrations first!

Companion
object
Graph
Supertypes
trait AutoDerived[From, To]
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def transform(src: From, failFast: Boolean): Result[To]

Run transformation using provided value as a source.

Run transformation using provided value as a source.

Value parameters

failFast

whether the transformation should return as early as the first set of errors appear (true), or should it attempt to convert what it can and then aggregate all errors (false)

src

source value

Attributes

Returns

io.scalaland.chimney.partial.Result of the transformation

Since

0.7.0

Concrete methods

final def transform(src: From): Result[To]

Run transformation using provided value as a source in error accumulation mode.

Run transformation using provided value as a source in error accumulation mode.

Value parameters

src

source value

Attributes

Returns

io.scalaland.chimney.partial.Result of the transformation

Since

0.7.0

final def transformFailFast(src: From): Result[To]

Run transformation using provided value as a source in short-circuit (fail fast) mode.

Run transformation using provided value as a source in short-circuit (fail fast) mode.

Value parameters

src

source value

Attributes

Returns

io.scalaland.chimney.partial.Result of the transformation

Since

0.7.0