Package org.openrewrite
Interface Tree
- All Known Subinterfaces:
Remote
,SourceFile
- All Known Implementing Classes:
Binary
,ParseError
,PlainText
,PlainText.Snippet
,Quark
,RemoteArchive
,RemoteFile
public interface Tree
-
Method Summary
Modifier and TypeMethodDescriptiondefault <R extends Tree,
P>
Raccept
(TreeVisitor<R, P> v, P p) Supports polymorphic visiting viaTreeVisitor.visit(Tree, Object)
.default <T2 extends Tree>
T2cast()
getId()
An id that can be used to identify a particular AST element, even after transformations have taken place on itdefault String
<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().default boolean
default String
default <P> String
print
(Cursor cursor, PrintOutputCapture<P> out) default <P> String
print
(TreeVisitor<?, PrintOutputCapture<Integer>> printer) default <P> TreeVisitor<?,
PrintOutputCapture<P>> default String
printTrimmed
(Cursor cursor) default String
printTrimmed
(TreeVisitor<?, PrintOutputCapture<Integer>> printer) default <P> String
printTrimmed
(P p, Cursor cursor) static UUID
randomId()
default <T2 extends Tree>
T2safeCast()
<T extends Tree>
T<T extends Tree>
TwithMarkers
(Markers markers)
-
Method Details
-
getJacksonPolymorphicTypeTag
-
randomId
-
getId
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
-
getMarkers
Markers getMarkers() -
withMarkers
-
withId
-
accept
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
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
-
print
-
print
-
print
-
printTrimmed
-
printTrimmed
-
printTrimmed
-
isScope
-
cast
-
safeCast
-