Class DataMapper.MapperEntry<T>

  • Type Parameters:
    T - the containing mapped type
    Enclosing class:
    DataMapper

    private static class DataMapper.MapperEntry<T>
    extends java.lang.Object
    Implements a mapper entry for MappingConsumer.
    Author:
    Holger Eichelberger, SSE
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.reflect.Method getter  
      private java.util.function.Consumer<java.lang.Object> translator  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private MapperEntry​(java.lang.reflect.Method getter)
      Creates a mapper entry for a given reflection getter method.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private boolean accept​(T instance)
      Accepts an instance of the mapped type by applying the getter to instance and if the result of the invocation is not null, calls the registered translator to accept the value of the getter call.
      private <A> void setConsumer​(java.lang.Class<A> cls, java.util.function.Consumer<A> consumer)
      Sets a configurable consumer for a given type.
      • Methods inherited from class java.lang.Object

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

      • getter

        private java.lang.reflect.Method getter
      • translator

        private java.util.function.Consumer<java.lang.Object> translator
    • Constructor Detail

      • MapperEntry

        private MapperEntry​(java.lang.reflect.Method getter)
        Creates a mapper entry for a given reflection getter method.
        Parameters:
        getter - the getter method
    • Method Detail

      • setConsumer

        private <A> void setConsumer​(java.lang.Class<A> cls,
                                     java.util.function.Consumer<A> consumer)
        Sets a configurable consumer for a given type. Exceptions are logged.
        Type Parameters:
        A - the type
        Parameters:
        cls - the type class
        consumer - the consumer to be added
      • accept

        private boolean accept​(T instance)
        Accepts an instance of the mapped type by applying the getter to instance and if the result of the invocation is not null, calls the registered translator to accept the value of the getter call. Exceptions are logged.
        Parameters:
        instance - the data instance to accept/process
        Returns:
        true if instance was passed on to a translator, false else