Class ConstantNode<T>

    • Field Detail

      • template

        protected final T template
    • Constructor Detail

      • ConstantNode

        public ConstantNode​(T template)
    • Method Detail

      • getTemplateNode

        public T getTemplateNode()
      • replaceNode

        public boolean replaceNode​(RootNode oldNode,
                                   RootNode newNode)
        Description copied from interface: RootNode
        Call it to modify Pattern structure. It is actually called mainly by PatternBuilder. TODO: May be we can move this method into some internal interface?
        Parameters:
        oldNode - old RootNode
        newNode - new RootNode
        Returns:
        a true if `oldNode` was found in this RootNode or it's children and replaced by `newNode` false if `oldNode` was not found
      • generateTargets

        public <U> void generateTargets​(DefaultGenerator generator,
                                        ResultHolder<U> result,
                                        ImmutableMap parameters)
        Description copied from interface: RootNode
        Generates zero, one or more target depending on kind of this RootNode, expected `result` and input `parameters`
        Parameters:
        generator - Generator which drives generation process
        result - holder for the generated objects
        parameters - a ImmutableMap holding parameters
      • matchTarget

        public ImmutableMap matchTarget​(Object target,
                                        ImmutableMap parameters)
        Parameters:
        target - - to be matched element
        parameters - will receive the matching parameter values
        Returns:
        true if `element` matches with pattern of this matcher
      • isTryNextMatch

        public boolean isTryNextMatch​(ImmutableMap parameters)
        Parameters:
        parameters - matching parameters
        Returns:
        true if this ValueResolver should be processed again to match next target in the state defined by current `parameters`.
      • matchTargets

        public TobeMatched matchTargets​(TobeMatched targets,
                                        Matchers next)
        Specified by:
        matchTargets in interface RootNode
        Parameters:
        targets - to be matched target nodes and input parameters
        next - Chain of matchers which has to be processed after this RootNode
        Returns:
        new parameters and container with remaining targets