Top Description Methods
org.codehaus.groovy.ast

public Interface NodeMetaDataHandler

Known Direct Implementers
org.apache.groovy.parser.antlr4.GroovyParser.GroovyParserRuleContext, org.codehaus.groovy.ast.ASTNode, org.codehaus.groovy.ast.CompileUnit
Annotations
@SuppressWarnings:unchecked, rawtypes
Imports
org.codehaus.groovy.GroovyBugError, org.codehaus.groovy.util.ListHashMap, java.util.Collections, .Map, java.util.function.Function

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

Method Summary

Modifier and TypeMethod and Description
public default void
copyNodeMetaData(NodeMetaDataHandler
the other node
other
)

Copies all node meta data from the other node to this one

public Map<?, ?>
public default <T> T

Returns:

the node meta data value for this key
getNodeMetaData
(Object
the meta data key
key
)

Gets the node meta data.

public default <T> T

Returns:

the node meta data value for this key
getNodeMetaData
(Object
the meta data key
key
,
Function<?, ? extends T>
the meta data value supplier
valFn
)

Gets the node meta data.

public default Map<?, ?>

Returns:

the node metadata. Always not null.
getNodeMetaData
()

Returns an unmodifiable view of the current node metadata.

public default Object

Returns:

the old node meta data value for this key
putNodeMetaData
(Object
the meta data key
key
,
Object
the meta data value
value
)

Sets the node meta data but allows overwriting values.

public default void
removeNodeMetaData(Object
the meta data key
key
)

Removes a node meta data entry.

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

public default void
setNodeMetaData(Object
the meta data key
key
,
Object
the meta data value
value
)

Sets the node meta data.

Method Detail

copyNodeMetaDataback to summary
public default void copyNodeMetaData(NodeMetaDataHandler other)

Copies all node meta data from the other node to this one

Parameters
other:NodeMetaDataHandler

the other node

getMetaDataMapback to summary
public Map<?, ?> getMetaDataMap()
getNodeMetaDataback to summary
public default <T> T getNodeMetaData(Object key)

Gets the node meta data.

Parameters
key:Object

the meta data key

Returns:T

the node meta data value for this key

getNodeMetaDataback to summary
public default <T> T getNodeMetaData(Object key, Function<?, ? extends T> valFn)

Gets the node meta data.

Parameters
key:Object

the meta data key

valFn:Function<?, ? extends T>

the meta data value supplier

Returns:T

the node meta data value for this key

getNodeMetaDataback to summary
public default Map<?, ?> getNodeMetaData()

Returns an unmodifiable view of the current node metadata.

Returns:Map<?, ?>

the node metadata. Always not null.

putNodeMetaDataback to summary
public default Object putNodeMetaData(Object key, Object value)

Sets the node meta data but allows overwriting values.

Parameters
key:Object

the meta data key

value:Object

the meta data value

Returns:Object

the old node meta data value for this key

Exceptions
GroovyBugError:
if key is null
removeNodeMetaDataback to summary
public default void removeNodeMetaData(Object key)

Removes a node meta data entry.

Parameters
key:Object

the meta data key

Exceptions
GroovyBugError:
if the key is null
setMetaDataMapback to summary
public void setMetaDataMap(Map<?, ?> metaDataMap)
setNodeMetaDataback to summary
public default void setNodeMetaData(Object key, Object value)

Sets the node meta data.

Parameters
key:Object

the meta data key

value:Object

the meta data value

Exceptions
GroovyBugError:
if key is null or there is already meta data under that key