Class DefinitionMap<D>

java.lang.Object
org.commonmark.node.DefinitionMap<D>
Type Parameters:
D - the type of value

public class DefinitionMap<D> extends 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 Details

    • type

      private final Class<D> type
    • definitions

      private final Map<String,D> definitions
  • Constructor Details

    • DefinitionMap

      public DefinitionMap(Class<D> type)
  • Method Details

    • getType

      public Class<D> getType()
    • addAll

      public void addAll(DefinitionMap<D> that)
    • putIfAbsent

      public D putIfAbsent(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(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 Set<String> keySet()
    • values

      public Collection<D> values()