Class DefinitionMap<D>

  • Type Parameters:
    D - the type of value

    public class DefinitionMap<D>
    extends java.lang.Object
    A map that can be used to store and look up reference definitions by a label. The labels are case-insensitive and normalized, the same way as for LinkReferenceDefinition nodes.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.String,​D> definitions  
      private java.lang.Class<D> type  
    • Constructor Summary

      Constructors 
      Constructor Description
      DefinitionMap​(java.lang.Class<D> type)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAll​(DefinitionMap<D> that)  
      D get​(java.lang.String label)
      Look up a definition by label.
      java.lang.Class<D> getType()  
      java.util.Set<java.lang.String> keySet()  
      D putIfAbsent​(java.lang.String label, D definition)
      Store a new definition unless one is already in the map.
      java.util.Collection<D> values()  
      • Methods inherited from class java.lang.Object

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

      • type

        private final java.lang.Class<D> type
      • definitions

        private final java.util.Map<java.lang.String,​D> definitions
    • Constructor Detail

      • DefinitionMap

        public DefinitionMap​(java.lang.Class<D> type)
    • Method Detail

      • getType

        public java.lang.Class<D> getType()
      • putIfAbsent

        public D putIfAbsent​(java.lang.String label,
                             D definition)
        Store a new definition unless one is already in the map. If there is no definition for that label yet, return null. Otherwise, return the existing definition.

        The label is normalized by the definition map before storing.

      • get

        public D get​(java.lang.String label)
        Look up a definition by label. The label is normalized by the definition map before lookup.
        Returns:
        the value or null
      • keySet

        public java.util.Set<java.lang.String> keySet()
      • values

        public java.util.Collection<D> values()