Interface NodeMetaDataHandler

All Known Implementing Classes:
AnnotatedNode, AnnotationConstantExpression, AnnotationNode, ArgumentListExpression, ArrayExpression, AssertStatement, ASTNode, AttributeExpression, BinaryExpression, BitwiseNegationExpression, BlockStatement, BooleanExpression, BreakStatement, BytecodeExpression, BytecodeSequence, CaseStatement, CastExpression, CatchStatement, ClassExpression, ClassNode, ClosureExpression, ClosureListExpression, CompareIdentityExpression, CompareToNullExpression, CompileUnit, CompileUnit.ConstructedOuterNestedClassNode, ConstantExpression, ConstructorCallExpression, ConstructorNode, ContinueStatement, DeclarationExpression, DecompiledClassNode, DoWhileStatement, ElvisOperatorExpression, EmptyExpression, EmptyStatement, EnumConstantClassNode, Expression, ExpressionAsVariableSlot, ExpressionStatement, ExtensionMethodNode, FieldExpression, FieldNode, ForStatement, GenericsType, GroovyParser.AdditiveExprAltContext, GroovyParser.AndExprAltContext, GroovyParser.AnnotatedQualifiedClassNameContext, GroovyParser.AnnotationContext, GroovyParser.AnnotationNameContext, GroovyParser.AnnotationsOptContext, GroovyParser.AnonymousInnerClassDeclarationContext, GroovyParser.ArgumentsContext, GroovyParser.ArrayInitializerContext, GroovyParser.AssertStatementContext, GroovyParser.AssertStmtAltContext, GroovyParser.AssignmentExprAltContext, GroovyParser.BlockContext, GroovyParser.BlockStatementContext, GroovyParser.BlockStatementsContext, GroovyParser.BlockStatementsOptContext, GroovyParser.BlockStmtAltContext, GroovyParser.BooleanLiteralAltContext, GroovyParser.BreakStatementContext, GroovyParser.BreakStmtAltContext, GroovyParser.BuiltInTypeContext, GroovyParser.BuiltInTypePrmrAltContext, GroovyParser.CastExprAltContext, GroovyParser.CastParExpressionContext, GroovyParser.CatchClauseContext, GroovyParser.CatchTypeContext, GroovyParser.ClassBodyContext, GroovyParser.ClassBodyDeclarationContext, GroovyParser.ClassDeclarationContext, GroovyParser.ClassicalForControlContext, GroovyParser.ClassNameContext, GroovyParser.ClassOrInterfaceModifierContext, GroovyParser.ClassOrInterfaceModifiersContext, GroovyParser.ClassOrInterfaceModifiersOptContext, GroovyParser.ClassOrInterfaceTypeContext, GroovyParser.ClosureContext, GroovyParser.ClosureOrLambdaExpressionContext, GroovyParser.ClosureOrLambdaExpressionPrmrAltContext, GroovyParser.CommandArgumentContext, GroovyParser.CommandExprAltContext, GroovyParser.CommandExpressionContext, GroovyParser.CompilationUnitContext, GroovyParser.ConditionalExprAltContext, GroovyParser.ConditionalStatementContext, GroovyParser.ConditionalStmtAltContext, GroovyParser.ContinueStatementContext, GroovyParser.ContinueStmtAltContext, GroovyParser.CreatedNameContext, GroovyParser.CreatorContext, GroovyParser.DimContext, GroovyParser.DoWhileStmtAltContext, GroovyParser.DynamicMemberNameContext, GroovyParser.ElementValueArrayInitializerContext, GroovyParser.ElementValueContext, GroovyParser.ElementValuePairContext, GroovyParser.ElementValuePairNameContext, GroovyParser.ElementValuePairsContext, GroovyParser.ElementValuesContext, GroovyParser.EmptyDimsContext, GroovyParser.EmptyDimsOptContext, GroovyParser.EmptyStmtAltContext, GroovyParser.EnhancedArgumentListElementContext, GroovyParser.EnhancedArgumentListInParContext, GroovyParser.EnhancedForControlContext, GroovyParser.EnhancedStatementExpressionContext, GroovyParser.EnumConstantContext, GroovyParser.EnumConstantsContext, GroovyParser.EqualityExprAltContext, GroovyParser.ExclusiveOrExprAltContext, GroovyParser.ExpressionContext, GroovyParser.ExpressionInParContext, GroovyParser.ExpressionListContext, GroovyParser.ExpressionListElementContext, GroovyParser.ExpressionStmtAltContext, GroovyParser.FieldDeclarationContext, GroovyParser.FinallyBlockContext, GroovyParser.FloatingPointLiteralAltContext, GroovyParser.ForControlContext, GroovyParser.ForInitContext, GroovyParser.FormalParameterContext, GroovyParser.FormalParameterListContext, GroovyParser.FormalParametersContext, GroovyParser.ForStmtAltContext, GroovyParser.ForUpdateContext, GroovyParser.GroovyParserRuleContext, GroovyParser.GstringContext, GroovyParser.GstringPathContext, GroovyParser.GstringPrmrAltContext, GroovyParser.GstringValueContext, GroovyParser.IdentifierContext, GroovyParser.IdentifierPrmrAltContext, GroovyParser.IfElseStatementContext, GroovyParser.ImportDeclarationContext, GroovyParser.InclusiveOrExprAltContext, GroovyParser.IndexPropertyArgsContext, GroovyParser.IntegerLiteralAltContext, GroovyParser.KeywordsContext, GroovyParser.LabeledStmtAltContext, GroovyParser.LambdaBodyContext, GroovyParser.ListContext, GroovyParser.ListPrmrAltContext, GroovyParser.LiteralContext, GroovyParser.LiteralPrmrAltContext, GroovyParser.LocalVariableDeclarationContext, GroovyParser.LocalVariableDeclarationStmtAltContext, GroovyParser.LogicalAndExprAltContext, GroovyParser.LogicalOrExprAltContext, GroovyParser.LoopStatementContext, GroovyParser.LoopStmtAltContext, GroovyParser.MapContext, GroovyParser.MapEntryContext, GroovyParser.MapEntryLabelContext, GroovyParser.MapEntryListContext, GroovyParser.MapPrmrAltContext, GroovyParser.MemberDeclarationContext, GroovyParser.MethodBodyContext, GroovyParser.MethodDeclarationContext, GroovyParser.MethodNameContext, GroovyParser.ModifierContext, GroovyParser.ModifiersContext, GroovyParser.ModifiersOptContext, GroovyParser.MultipleAssignmentExprAltContext, GroovyParser.MultiplicativeExprAltContext, GroovyParser.NamedPropertyArgsContext, GroovyParser.NamePartContext, GroovyParser.NewPrmrAltContext, GroovyParser.NlsContext, GroovyParser.NonWildcardTypeArgumentsContext, GroovyParser.NullLiteralAltContext, GroovyParser.PackageDeclarationContext, GroovyParser.ParenPrmrAltContext, GroovyParser.ParExpressionContext, GroovyParser.PathElementContext, GroovyParser.PathExpressionContext, GroovyParser.PostfixExprAltContext, GroovyParser.PostfixExpressionContext, GroovyParser.PowerExprAltContext, GroovyParser.PrimaryContext, GroovyParser.PrimitiveTypeContext, GroovyParser.QualifiedClassNameContext, GroovyParser.QualifiedClassNameListContext, GroovyParser.QualifiedNameContext, GroovyParser.QualifiedNameElementContext, GroovyParser.QualifiedNameElementsContext, GroovyParser.QualifiedStandardClassNameContext, GroovyParser.RegexExprAltContext, GroovyParser.RelationalExprAltContext, GroovyParser.ResourceContext, GroovyParser.ResourceListContext, GroovyParser.ResourcesContext, GroovyParser.ReturnStmtAltContext, GroovyParser.ReturnTypeContext, GroovyParser.RparenContext, GroovyParser.ScriptStatementContext, GroovyParser.ScriptStatementsContext, GroovyParser.SepContext, GroovyParser.ShiftExprAltContext, GroovyParser.StandardLambdaExpressionContext, GroovyParser.StandardLambdaParametersContext, GroovyParser.StatementContext, GroovyParser.StatementExpressionContext, GroovyParser.StringLiteralAltContext, GroovyParser.StringLiteralContext, GroovyParser.SuperPrmrAltContext, GroovyParser.SwitchBlockStatementGroupContext, GroovyParser.SwitchLabelContext, GroovyParser.SwitchStatementContext, GroovyParser.SynchronizedStmtAltContext, GroovyParser.ThisFormalParameterContext, GroovyParser.ThisPrmrAltContext, GroovyParser.ThrowStmtAltContext, GroovyParser.TryCatchStatementContext, GroovyParser.TryCatchStmtAltContext, GroovyParser.TypeArgumentContext, GroovyParser.TypeArgumentsContext, GroovyParser.TypeArgumentsOrDiamondContext, GroovyParser.TypeBoundContext, GroovyParser.TypeContext, GroovyParser.TypeDeclarationContext, GroovyParser.TypeListContext, GroovyParser.TypeNamePairContext, GroovyParser.TypeNamePairsContext, GroovyParser.TypeParameterContext, GroovyParser.TypeParametersContext, GroovyParser.UnaryAddExprAltContext, GroovyParser.UnaryNotExprAltContext, GroovyParser.VariableDeclarationContext, GroovyParser.VariableDeclaratorContext, GroovyParser.VariableDeclaratorIdContext, GroovyParser.VariableDeclaratorsContext, GroovyParser.VariableInitializerContext, GroovyParser.VariableInitializersContext, GroovyParser.VariableModifierContext, GroovyParser.VariableModifiersContext, GroovyParser.VariableModifiersOptContext, GroovyParser.VariableNamesContext, GroovyParser.WhileStmtAltContext, GStringExpression, IfStatement, ImportNode, InnerClassNode, InterfaceHelperClassNode, LambdaExpression, ListExpression, ListOfExpressionsExpression, MapEntryExpression, MapExpression, MethodCallExpression, MethodNode, MethodPointerExpression, MethodReferenceExpression, MixinNode, ModifierNode, ModuleNode, NamedArgumentListExpression, NotExpression, PackageNode, Parameter, PostfixExpression, PrefixExpression, PropertyExpression, PropertyNode, RangeExpression, ReturnStatement, SpreadExpression, SpreadMapExpression, Statement, StaticMethodCallExpression, SwitchStatement, SynchronizedStatement, TemporaryVariableExpression, TernaryExpression, ThrowStatement, TryCatchStatement, TupleExpression, UnaryMinusExpression, UnaryPlusExpression, VariableExpression, VariableSlotLoader, WhileStatement, WideningCategories.LowestUpperBoundClassNode

public interface NodeMetaDataHandler
An interface to mark a node being able to handle metadata.
  • Method Summary

    Modifier and Type Method Description
    default void copyNodeMetaData​(NodeMetaDataHandler other)
    Copies all node meta data from the other node to this one
    java.util.Map<?,​?> getMetaDataMap()  
    default java.util.Map<?,​?> getNodeMetaData()
    Returns an unmodifiable view of the current node metadata.
    default <T> T getNodeMetaData​(java.lang.Object key)
    Gets the node meta data.
    default <T> T getNodeMetaData​(java.lang.Object key, java.util.function.Function<?,​? extends T> valFn)
    Gets the node meta data.
    default java.lang.Object putNodeMetaData​(java.lang.Object key, java.lang.Object value)
    Sets the node meta data but allows overwriting values.
    default void removeNodeMetaData​(java.lang.Object key)
    Removes a node meta data entry.
    void setMetaDataMap​(java.util.Map<?,​?> metaDataMap)  
    default void setNodeMetaData​(java.lang.Object key, java.lang.Object value)
    Sets the node meta data.
  • Method Details

    • getNodeMetaData

      default <T> T getNodeMetaData​(java.lang.Object key)
      Gets the node meta data.
      Parameters:
      key - the meta data key
      Returns:
      the node meta data value for this key
    • getNodeMetaData

      default <T> T getNodeMetaData​(java.lang.Object key, java.util.function.Function<?,​? extends T> valFn)
      Gets the node meta data.
      Parameters:
      key - the meta data key
      valFn - the meta data value supplier
      Returns:
      the node meta data value for this key
    • copyNodeMetaData

      default void copyNodeMetaData​(NodeMetaDataHandler other)
      Copies all node meta data from the other node to this one
      Parameters:
      other - the other node
    • setNodeMetaData

      default void setNodeMetaData​(java.lang.Object key, java.lang.Object value)
      Sets the node meta data.
      Parameters:
      key - the meta data key
      value - the meta data value
      Throws:
      GroovyBugError - if key is null or there is already meta data under that key
    • putNodeMetaData

      default java.lang.Object putNodeMetaData​(java.lang.Object key, java.lang.Object value)
      Sets the node meta data but allows overwriting values.
      Parameters:
      key - the meta data key
      value - the meta data value
      Returns:
      the old node meta data value for this key
      Throws:
      GroovyBugError - if key is null
    • removeNodeMetaData

      default void removeNodeMetaData​(java.lang.Object key)
      Removes a node meta data entry.
      Parameters:
      key - the meta data key
      Throws:
      GroovyBugError - if the key is null
    • getNodeMetaData

      default java.util.Map<?,​?> getNodeMetaData()
      Returns an unmodifiable view of the current node metadata.
      Returns:
      the node metadata. Always not null.
    • getMetaDataMap

      java.util.Map<?,​?> getMetaDataMap()
    • setMetaDataMap

      void setMetaDataMap​(java.util.Map<?,​?> metaDataMap)