Class BaseHierarchicalConfiguration.InterpolatedVisitor

    • Field Detail

      • builderStack

        private final java.util.List<ImmutableNode.Builder> builderStack
        A stack for managing node builder instances.
      • interpolatedRoot

        private ImmutableNode interpolatedRoot
        The resulting root node.
    • Constructor Detail

      • InterpolatedVisitor

        public InterpolatedVisitor()
        Creates a new instance of InterpolatedVisitor.
    • Method Detail

      • getInterpolatedRoot

        public ImmutableNode getInterpolatedRoot()
        Gets the result of this builder: the root node of the interpolated nodes hierarchy.
        Returns:
        the resulting root node
      • handleLeafNode

        private void handleLeafNode​(ImmutableNode node,
                                    NodeHandler<ImmutableNode> handler)
        Handles interpolation for a node with no children. If interpolation does not change this node, it is copied as is to the resulting structure. Otherwise, a new node is created with the interpolated values.
        Parameters:
        node - the current node to be processed
        handler - the NodeHandler
      • interpolateAttributes

        private java.util.Map<java.lang.String,​java.lang.Object> interpolateAttributes​(ImmutableNode node,
                                                                                             NodeHandler<ImmutableNode> handler)
        Returns a map with interpolated attributes of the passed in node.
        Parameters:
        node - the current node to be processed
        handler - the NodeHandler
        Returns:
        the map with interpolated attributes
      • interpolateAttributes

        private boolean interpolateAttributes​(ImmutableNode node,
                                              NodeHandler<ImmutableNode> handler,
                                              java.util.Map<java.lang.String,​java.lang.Object> interpolatedAttributes)
        Populates a map with interpolated attributes of the passed in node.
        Parameters:
        node - the current node to be processed
        handler - the NodeHandler
        interpolatedAttributes - a map for storing the results
        Returns:
        a flag whether an attribute value was changed by interpolation
      • isLeafNode

        private boolean isLeafNode​(ImmutableNode node,
                                   NodeHandler<ImmutableNode> handler)
        Returns a flag whether the given node is a leaf. This is the case if it does not have children.
        Parameters:
        node - the node in question
        handler - the NodeHandler
        Returns:
        a flag whether this is a leaf node
      • peek

        private ImmutableNode.Builder peek()
        Returns the top-level element from the stack without removing it.
        Returns:
        the top-level element from the stack
      • pop

        private ImmutableNode.Builder pop()
        Pops the top-level element from the stack.
        Returns:
        the element popped from the stack
      • push

        private void push​(ImmutableNode.Builder builder)
        Pushes a new builder on the stack.
        Parameters:
        builder - the builder
      • storeInterpolatedNode

        private void storeInterpolatedNode​(ImmutableNode node)
        Stores a processed node. Per default, the node is added to the current builder on the stack. If no such builder exists, this is the result node.
        Parameters:
        node - the node to be stored
      • valueChanged

        private boolean valueChanged​(java.lang.Object interpolatedValue,
                                     java.lang.Object value)
        Tests whether a value is changed because of interpolation.
        Parameters:
        interpolatedValue - the interpolated value
        value - the original value
        Returns:
        a flag whether the value was changed