Package org.openrewrite
Interface Tree
-
- All Known Subinterfaces:
Marker,Polyglot,Polyglot.Member,SourceFile
- All Known Implementing Classes:
BuildTool,DeclarativeNamedStyles,FileListing,Generated,GitProvenance,Markers,NamedStyles,PlainText,Polyglot.ArrayElement,Polyglot.ArrayElements,Polyglot.Error,Polyglot.Executable,Polyglot.HashEntries,Polyglot.HashEntry,Polyglot.Instance,Polyglot.Instantiable,Polyglot.Members,Polyglot.NumberValue,Polyglot.Source,Polyglot.StringValue,Polyglot.ValueMarker,PolyglotTree,Range,RecipesThatMadeChanges,SearchResult
public interface Tree
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <R extends Tree,P>
Raccept(TreeVisitor<R,P> v, P p)Supports polymorphic visiting viaTreeVisitor.visit(Tree, Object).java.util.UUIDgetId()An id that can be used to identify a particular AST element, even after transformations have taken place on itdefault java.lang.StringgetJacksonPolymorphicTypeTag()<P> booleanisAcceptable(TreeVisitor<?,P> v, P p)Checks the supplied argument to see if the supplied visitor and its context would be valid arguments to accept().default booleanisScope(@Nullable Tree tree)default java.lang.Stringprint(Cursor cursor)default java.lang.Stringprint(TreeVisitor<?,PrintOutputCapture<java.lang.Integer>> printer)default <P> java.lang.Stringprint(P p, Cursor cursor)default <P> java.lang.Stringprint(P p, TreeVisitor<?,PrintOutputCapture<P>> printer)default <P> TreeVisitor<?,PrintOutputCapture<P>>printer(Cursor cursor)default java.lang.StringprintTrimmed(Cursor cursor)default java.lang.StringprintTrimmed(TreeVisitor<?,PrintOutputCapture<java.lang.Integer>> printer)default <P> java.lang.StringprintTrimmed(P p, Cursor cursor)static java.util.UUIDrandomId()
-
-
-
Method Detail
-
getJacksonPolymorphicTypeTag
default java.lang.String getJacksonPolymorphicTypeTag()
-
randomId
static java.util.UUID randomId()
-
getId
java.util.UUID getId()
An id that can be used to identify a particular AST element, even after transformations have taken place on it- Returns:
- A unique identifier
-
accept
@Nullable default <R extends Tree,P> R accept(TreeVisitor<R,P> v, P p)
Supports polymorphic visiting viaTreeVisitor.visit(Tree, Object). This is useful in cases where an AST type contains a field that is of a type with a hierarchy. The visitor doesn't have to figure out which visit method to call by using instanceof.- Type Parameters:
R- visitor return typeP- visit context type- Parameters:
v- visitorp- visit context- Returns:
- visitor result
-
isAcceptable
<P> boolean isAcceptable(TreeVisitor<?,P> v, P p)
Checks the supplied argument to see if the supplied visitor and its context would be valid arguments to accept(). Typically this involves checking that the visitor is of a type that operates on this kind of tree. e.g.: A Java Tree implementation would return true for JavaVisitors and false for MavenVisitors- Type Parameters:
P- the visitor's context argument- Returns:
- 'true' if the arguments to this function would be valid arguments to accept()
-
printer
default <P> TreeVisitor<?,PrintOutputCapture<P>> printer(Cursor cursor)
-
print
default <P> java.lang.String print(P p, Cursor cursor)
-
print
default <P> java.lang.String print(P p, TreeVisitor<?,PrintOutputCapture<P>> printer)
-
print
default java.lang.String print(Cursor cursor)
-
print
default java.lang.String print(TreeVisitor<?,PrintOutputCapture<java.lang.Integer>> printer)
-
printTrimmed
default <P> java.lang.String printTrimmed(P p, Cursor cursor)
-
printTrimmed
default java.lang.String printTrimmed(Cursor cursor)
-
printTrimmed
default java.lang.String printTrimmed(TreeVisitor<?,PrintOutputCapture<java.lang.Integer>> printer)
-
-