NodeMetaDataHandler (Groovy 5.0.8)

Package: org.codehaus.groovy.ast

## [Java] Interface NodeMetaDataHandler

-     @SuppressWarnings({"unchecked", "rawtypes"})
      public interface NodeMetaDataHandler

  An interface to mark a node being able to handle metadata.

  Since:
    3.0.0

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public void` | `copyNodeMetaData(NodeMetaDataHandler other)` Copies all node metadata from the other node to this one
    `` | `public Map<?, ?>` | `getMetaDataMap()`
    `<T>` | `public T` | `getNodeMetaData(Object key)` Gets the node metadata.
    `<T>` | `public T` | `getNodeMetaData(Object key, Function<?, ? extends T> valFn)` Gets the node metadata.
    `` | `public Map<?, ?>` | `getNodeMetaData()` Returns an unmodifiable view of the current node metadata.
    `` | `public Map<?, ?>` | `newMetaDataMap()` Since: 5.0.0
    `` | `public Object` | `putNodeMetaData(Object key, Object value)` Sets the node metadata but allows overwriting values.
    `` | `public void` | `removeNodeMetaData(Object key)` Removes a node metadata entry.
    `` | `public void` | `setMetaDataMap(Map<?, ?> metaDataMap)`
    `` | `public void` | `setNodeMetaData(Object key, Object value)` Sets the node metadata.

- - ### Method Detail

    - #### public void copyNodeMetaData(NodeMetaDataHandler other)

      Copies all node metadata from the other node to this one

      Parameters:
        `other` - the other node

    - #### public Map<?, ?> getMetaDataMap()

    - #### <T> public T getNodeMetaData(Object key)

      Gets the node metadata.

      Parameters:
        `key` - the metadata key
      Returns:
        the node metadata value for this key

    - #### <T> public T getNodeMetaData(Object key, Function<?, ? extends T> valFn)

      Gets the node metadata.

      Parameters:
        `key` - the metadata key
        `valFn` - the metadata value supplier
      Returns:
        the node metadata value for this key

    - #### public Map<?, ?> getNodeMetaData()

      Returns an unmodifiable view of the current node metadata.

      Returns:
        the node metadata. Always not null.

    - #### public Map<?, ?> newMetaDataMap()

      Since:
        5.0.0

    - #### public Object putNodeMetaData(Object key, Object value)

      Sets the node metadata but allows overwriting values.

      throws:
        GroovyBugError if key is null
      Parameters:
        `key` - the metadata key
        `value` - the metadata value
      Returns:
        the old node metadata value for this key

    - #### public void removeNodeMetaData(Object key)

      Removes a node metadata entry.

      throws:
        GroovyBugError if the key is null
      Parameters:
        `key` - the metadata key

    - #### public void setMetaDataMap(Map<?, ?> metaDataMap)

    - #### public void setNodeMetaData(Object key, Object value)

      Sets the node metadata.

      throws:
        GroovyBugError if key is null or there is already metadata for key
      Parameters:
        `key` - the metadata key
        `value` - the metadata value