Package org.openrewrite.text
Class PlainText
java.lang.Object
org.openrewrite.text.PlainText
- All Implemented Interfaces:
SourceFile
,Tree
The simplest of all ASTs representing nothing more than just unstructured text.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<R extends Tree,
P>
Raccept
(TreeVisitor<R, P> v, P p) Supports polymorphic visiting viaTreeVisitor.visit(Tree, Object)
.long
A measure of the size of the AST by count of number of AST nodes or some other similar measure.<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().<P> TreeVisitor<?,
PrintOutputCapture<P>> withCharset
(Charset charset) withSnippets
(@Nullable List<PlainText.Snippet> snippets) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.openrewrite.SourceFile
getChecksum, getFileAttributes, getSourcePath, getStyle, getStyle, isCharsetBomMarked, printAll, printAll, printAll, printAllAsBytes, printAllAsBytes, printAllTrimmed, printAllTrimmed, printEqualsInput, withCharsetBomMarked, withChecksum, withFileAttributes, withSourcePath
Methods inherited from interface org.openrewrite.Tree
cast, getId, getJacksonPolymorphicTypeTag, getMarkers, isScope, print, print, print, printTrimmed, printTrimmed, printTrimmed, safeCast, withId, withMarkers
-
Constructor Details
-
PlainText
public PlainText()
-
-
Method Details
-
getCharset
- Specified by:
getCharset
in interfaceSourceFile
-
withCharset
- Specified by:
withCharset
in interfaceSourceFile
-
withText
-
isAcceptable
Description copied from interface:Tree
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- Specified by:
isAcceptable
in interfaceTree
- Type Parameters:
P
- the visitor's context argument- Returns:
- 'true' if the arguments to this function would be valid arguments to accept()
-
accept
Description copied from interface:Tree
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. -
printer
- Specified by:
printer
in interfaceSourceFile
- Specified by:
printer
in interfaceTree
-
getWeight
Description copied from interface:SourceFile
A measure of the size of the AST by count of number of AST nodes or some other similar measure. Because perfect referential uniqueness is space inefficient, this weight will always be approximate and is best used for comparative size between two ASTs rather than an absolute measure.- Specified by:
getWeight
in interfaceSourceFile
- Parameters:
uniqueIdentity
- A means of only counting referentially equal AST nodes once. In performance sensitive situations this should use a probabilistic set membership data structure.- Returns:
- The weight of the AST.
-
getSnippets
-
withSnippets
-