Class LineFilter

All Implemented Interfaces:
Filter<CtStatement>

public class LineFilter extends TypeFilter<CtStatement>
This filter matches all elements that can be considered as line of code (e.g. directly contained in a block, or a then statement). This discards CtStatement that are not used as statement (such as a method call used as RHS).
 // lines of a method
 List<CtStatement> lines = method.getElements(new LineFilter());
 // find the parent that is used as a statement (in a block or in a branch)
 CtStatement parentStatement = element.getParent(new LineFilter());
 
  • Constructor Details

    • LineFilter

      public LineFilter()
      Creates the filter.
  • Method Details