Class NullSafeMapper<F,​T>

  • Type Parameters:
    F - the type to map from.
    T - the type to map to.
    All Implemented Interfaces:
    Mapper<F,​T>
    Direct Known Subclasses:
    NullSafeBiMapper, NullSafeMultiMapper

    public abstract class NullSafeMapper<F,​T>
    extends java.lang.Object
    implements Mapper<F,​T>
    Null-safe unidirectional type mapper.
    See Also:
    Mapper
    • Constructor Summary

      Constructors 
      Constructor Description
      NullSafeMapper()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      T from​(F input)
      Maps the from type to the to type.
      protected abstract T nonNullFrom​(F input)
      Maps the from type to the to type.
      • Methods inherited from class java.lang.Object

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

      • NullSafeMapper

        public NullSafeMapper()
    • Method Detail

      • from

        public final T from​(F input)
        Maps the from type to the to type. Does not pass null references to the mapping method.
        Specified by:
        from in interface Mapper<F,​T>
        Parameters:
        input - from object.
        Returns:
        to object. null if input is null.
      • nonNullFrom

        protected abstract T nonNullFrom​(F input)
        Maps the from type to the to type.
        Parameters:
        input - from object.
        Returns:
        to object.
        See Also:
        Mapper.from(Object)