Package org.commonmark.node
Class DefinitionMap<D>
- java.lang.Object
-
- org.commonmark.node.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 forLinkReferenceDefinition
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()
-
-
-
Constructor Detail
-
DefinitionMap
public DefinitionMap(java.lang.Class<D> type)
-
-
Method Detail
-
getType
public java.lang.Class<D> getType()
-
addAll
public void addAll(DefinitionMap<D> that)
-
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()
-
-