Class EnumMappie

  • All Implemented Interfaces:

    
    public abstract class EnumMappie<FROM extends Enum<?>, TO extends Enum<?>>
     implements Mappie<TO>
                        

    Base class for enum mappers. See the documentation for a complete overview of how to generate enum mappers.

    For example

    class PersonMapper : EnumMappie<Color, Colour>() {
         override fun map(from: Color) = mapping()
    }

    will generate a mapper from Color to Colour, assuming both Color and Colour have a resolvable mapping.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      EnumMappie()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      TO map(FROM from) Map from to an instance of TO.
      final TO mapNullable(FROM from) Map nullable from to an instance of TO.
      final List<TO> mapList(List<FROM> from) Map each element in from to an instance of TO.
      final Set<TO> mapSet(Set<FROM> from) Map each element in from to an instance of TO.
      • Methods inherited from class java.lang.Object

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

      • EnumMappie

        EnumMappie()
    • Method Detail

      • map

         TO map(FROM from)

        Map from to an instance of TO.

        Parameters:
        from - the source value.
        Returns:

        from mapped to an instance of TO.

      • mapNullable

         final TO mapNullable(FROM from)

        Map nullable from to an instance of TO.

        Parameters:
        from - the source value.
        Returns:

        from mapped to an instance of TO.

      • mapList

         final List<TO> mapList(List<FROM> from)

        Map each element in from to an instance of TO.

        Parameters:
        from - the source values.
        Returns:

        from mapped to a list of instances of TO.

      • mapSet

         final Set<TO> mapSet(Set<FROM> from)

        Map each element in from to an instance of TO.

        Parameters:
        from - the source values.
        Returns:

        from mapped to a set of instances of TO.