Class MappingService


  • public class MappingService
    extends java.lang.Object
    Service for mapping arbitrary items to arbitrary keys.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  MappingService.KeyProvider
      A KeyProvider provides a key, to be used for the mapping of a specific item.
    • Constructor Summary

      Constructors 
      Constructor Description
      MappingService()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Map<java.lang.Object,​java.lang.Object> mapItems​(MappingService.KeyProvider keyProvider, java.util.Collection<? extends java.lang.Object> items)
      Maps all the items in items to corresponding keys retrieved by the MappingService.KeyProvider kp, i.e.
      • Methods inherited from class java.lang.Object

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

      • MappingService

        public MappingService()
    • Method Detail

      • mapItems

        public static java.util.Map<java.lang.Object,​java.lang.Object> mapItems​(MappingService.KeyProvider keyProvider,
                                                                                      java.util.Collection<? extends java.lang.Object> items)
                                                                               throws java.lang.IllegalArgumentException
        Maps all the items in items to corresponding keys retrieved by the MappingService.KeyProvider kp, i.e. each entry will look like this (item being an element in items): <kp.getKey(item), item>
        Parameters:
        keyProvider - the MappingService.KeyProvider used for mapping items
        items - the items to be mapped
        Returns:
        a map with a value set corresponding to the elements of items and a key set corresponding to the keys retrieved by the specified MappingService.KeyProvider
        Throws:
        java.lang.IllegalArgumentException - if no key could be retrieved for a specific item in items using the specified MappingService.KeyProvider kp.
        See Also:
        MappingService.KeyProvider