Package spoon.pattern

Class PatternBuilderHelper


  • public class PatternBuilderHelper
    extends Object
    Utility class to select parts of AST to be used as a model of a PatternBuilder. Main documentation at http://spoon.gforge.inria.fr/pattern.html.
    • Constructor Detail

      • PatternBuilderHelper

        public PatternBuilderHelper​(CtType<?> templateTemplate)
    • Method Detail

      • setBodyOfMethod

        public PatternBuilderHelper setBodyOfMethod​(String methodName)
        Sets a template model from body of the method of template type
        Parameters:
        methodName - the name of CtMethod
      • setReturnExpressionOfMethod

        public PatternBuilderHelper setReturnExpressionOfMethod​(String methodName)
        Sets a template model from return expression of the method of template type selected by filter
        Parameters:
        methodName - the name of CtMethod
      • keepTypeMembers

        public PatternBuilderHelper keepTypeMembers​(Filter<? super CtElement> filter)
        Parameters:
        filter - whose matches will be kept in the template. All others will be removed
      • removeSuperClass

        public PatternBuilderHelper removeSuperClass()
        removes super class from the template
      • getPatternElements

        public List<CtElement> getPatternElements()
        Returns:
        a List of CtElements, which has to be used as pattern model