Class TransformableValue

  • All Implemented Interfaces:

    
    public final class TransformableValue<FROM extends Object, TO extends Object>
    
                        

    The result of an explicit mapping definition which can be transformed.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Unit transform(Function1<FROM, TO> function) Transforms the result value of a mapping.
      final <M extends Mappie<TO>> M via(M mapper) Transforms the result value of a mapping using a different mapper.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TransformableValue

        TransformableValue()
    • Method Detail

      • transform

         final Unit transform(Function1<FROM, TO> function)

        Transforms the result value of a mapping. See the documentation

        For example

        Person::age fromProperty PersonDto::dateOfBirth transform { it.periodUntil(Clock.todayIn(TimeZone.UTC)) }

        will generate an explicit mapping transforming PersonDto.dateOfBirth to the period between it and today.

        Parameters:
        function - the transformation function to transform the value with.
      • via

         final <M extends Mappie<TO>> M via(M mapper)

        Transforms the result value of a mapping using a different mapper. See the documentation

        Parameters:
        mapper - the mapper to transform the value with.