Package org.openrewrite.java.tree
Class Space
- java.lang.Object
-
- org.openrewrite.java.tree.Space
-
- All Implemented Interfaces:
org.openrewrite.marker.Markable
public class Space extends java.lang.Object implements org.openrewrite.marker.Markable
Wherever whitespace can occur in Java, so can comments (at least block and javadoc style comments). So whitespace and comments are like peanut butter and jelly.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Space.Location
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Space
build(@Nullable java.lang.String whitespace, java.util.List<Comment> comments, org.openrewrite.marker.Markers markers)
static Space
firstPrefix(@Nullable java.util.List<? extends J> trees)
static Space
format(java.lang.String formatting)
static <J2 extends J>
java.util.List<J2>formatFirstPrefix(java.util.List<J2> trees, Space prefix)
static <J2 extends J>
java.util.List<JRightPadded<J2>>formatLastSuffix(@Nullable java.util.List<JRightPadded<J2>> trees, Space suffix)
java.util.List<Comment>
getComments()
java.lang.String
getIndent()
java.lang.String
getLastWhitespace()
org.openrewrite.marker.Markers
getMarkers()
java.lang.String
getWhitespace()
boolean
isEmpty()
java.lang.String
toString()
Space
withComments(java.util.List<Comment> comments)
Space
withMarkers(org.openrewrite.marker.Markers markers)
Space
withWhitespace(java.lang.String whitespace)
-
-
-
Field Detail
-
EMPTY
public static final Space EMPTY
-
-
Method Detail
-
build
public static Space build(@Nullable @Nullable java.lang.String whitespace, java.util.List<Comment> comments, org.openrewrite.marker.Markers markers)
-
getIndent
public java.lang.String getIndent()
-
getLastWhitespace
public java.lang.String getLastWhitespace()
-
getComments
public java.util.List<Comment> getComments()
-
getWhitespace
public java.lang.String getWhitespace()
-
getMarkers
public org.openrewrite.marker.Markers getMarkers()
- Specified by:
getMarkers
in interfaceorg.openrewrite.marker.Markable
-
withMarkers
public Space withMarkers(org.openrewrite.marker.Markers markers)
- Specified by:
withMarkers
in interfaceorg.openrewrite.marker.Markable
-
withWhitespace
public Space withWhitespace(java.lang.String whitespace)
-
isEmpty
public boolean isEmpty()
-
format
public static Space format(java.lang.String formatting)
-
formatLastSuffix
public static <J2 extends J> java.util.List<JRightPadded<J2>> formatLastSuffix(@Nullable @Nullable java.util.List<JRightPadded<J2>> trees, Space suffix)
-
formatFirstPrefix
public static <J2 extends J> java.util.List<J2> formatFirstPrefix(java.util.List<J2> trees, Space prefix)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-