Class DataMapper.MappingConsumer<T>

  • Type Parameters:
    T - the mapped type
    All Implemented Interfaces:
    java.util.function.Consumer<T>
    Direct Known Subclasses:
    DataMapper.BaseMappingConsumer
    Enclosing class:
    DataMapper

    public static class DataMapper.MappingConsumer<T>
    extends java.lang.Object
    implements java.util.function.Consumer<T>
    Provides a default consumer implementation for DataMapper.mapJsonData(InputStream, Class, Consumer) which maps attribute values to registered consumers.
    Author:
    Holger Eichelberger, SSE
    • Constructor Summary

      Constructors 
      Constructor Description
      MappingConsumer​(java.lang.Class<T> cls)
      Creates a mapping consumer for the given cls type.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void accept​(T value)  
      <A> void addHandler​(java.lang.Class<A> cls, java.util.function.Consumer<A> cons)
      Adds a handler for cls based on the consumer cons.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.function.Consumer

        andThen
    • Constructor Detail

      • MappingConsumer

        public MappingConsumer​(java.lang.Class<T> cls)
        Creates a mapping consumer for the given cls type.
        Parameters:
        cls - the class to do the mapping for
    • Method Detail

      • addHandler

        public <A> void addHandler​(java.lang.Class<A> cls,
                                   java.util.function.Consumer<A> cons)
        Adds a handler for cls based on the consumer cons.
        Type Parameters:
        A - the data type to be handled
        Parameters:
        cls - the class to handle (may be null, then this call is ignored)
        cons - the corresponding consumer (may be null, then this call is ignored)
      • accept

        public void accept​(T value)
        Specified by:
        accept in interface java.util.function.Consumer<T>