Class CtPathImpl

java.lang.Object
spoon.reflect.path.impl.CtPathImpl
All Implemented Interfaces:
CtPath

public class CtPathImpl extends Object implements CtPath
Default implementation for a CtPath
  • Constructor Details

    • CtPathImpl

      public CtPathImpl()
  • Method Details

    • getElements

      public List<CtPathElement> getElements()
    • evaluateOn

      public <T extends CtElement> List<T> evaluateOn(CtElement... startNode)
      Description copied from interface: CtPath
      Search for elements matching this CtPatch from start nodes given as parameters.
      Specified by:
      evaluateOn in interface CtPath
    • relativePath

      public CtPath relativePath(CtElement parent)
      Description copied from interface: CtPath
      Returns the path that is relative to the given element (subpath from it to the end of the path). This is used to have relative paths, instead of absolute path from the root package. For example, "#typeMember[index=2]#body#statement[index=2]#else" is a relative path to the class of absolute path "#subPackage[name=spoon]#subPackage[name=test]#subPackage[name=path]#subPackage[name=testclasses]#containedType[name=Foo]#typeMember[index=2]#body#statement[index=2]#else"
      Specified by:
      relativePath in interface CtPath
    • addFirst

      public CtPathImpl addFirst(CtPathElement element)
    • addLast

      public CtPathImpl addLast(CtPathElement element)
    • toString

      public String toString()
      Overrides:
      toString in class Object