Package org.openrewrite.java.tree
Class JContainer<T>
- java.lang.Object
-
- org.openrewrite.java.tree.JContainer<T>
-
- Type Parameters:
T
- The type of the inner list of elements.
public class JContainer<T> extends java.lang.Object
AST elements that contain lists of trees with some delimiter like parentheses, e.g. method arguments, annotation arguments, catch variable declarations.Sometimes the delimiter surrounds the list. Parentheses surround method arguments. Sometimes the delimiter only precedes the list. Throws statements on method declarations are preceded by the "throws" keyword.
Sometimes containers are optional in the grammar, as in the case of annotation arguments. Sometimes they are required, as in the case of method invocation arguments.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JContainer.Location
static class
JContainer.Padding<T>
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> JContainer<T>
build(java.util.List<JRightPadded<T>> elements)
static <T> JContainer<T>
build(Space before, java.util.List<JRightPadded<T>> elements, org.openrewrite.marker.Markers markers)
static <T> JContainer<T>
empty()
Space
getBefore()
java.util.List<T>
getElements()
Space
getLastSpace()
org.openrewrite.marker.Markers
getMarkers()
JContainer.Padding<T>
getPadding()
JContainer<T>
map(java.util.function.UnaryOperator<T> map)
java.lang.String
toString()
JContainer<T>
withBefore(Space before)
static <J2 extends J>
JContainer<J2>withElements(JContainer<J2> before, @Nullable java.util.List<J2> elements)
static <J2 extends J>
@Nullable JContainer<J2>withElementsNullable(@Nullable JContainer<J2> before, @Nullable java.util.List<J2> elements)
JContainer<T>
withMarkers(org.openrewrite.marker.Markers markers)
-
-
-
Method Detail
-
build
public static <T> JContainer<T> build(java.util.List<JRightPadded<T>> elements)
-
build
public static <T> JContainer<T> build(Space before, java.util.List<JRightPadded<T>> elements, org.openrewrite.marker.Markers markers)
-
empty
public static <T> JContainer<T> empty()
-
withBefore
public JContainer<T> withBefore(Space before)
-
withMarkers
public JContainer<T> withMarkers(org.openrewrite.marker.Markers markers)
-
getMarkers
public org.openrewrite.marker.Markers getMarkers()
-
getElements
public java.util.List<T> getElements()
-
getBefore
public Space getBefore()
-
map
public JContainer<T> map(java.util.function.UnaryOperator<T> map)
-
getLastSpace
public Space getLastSpace()
-
getPadding
public JContainer.Padding<T> getPadding()
-
withElementsNullable
@Nullable public static <J2 extends J> @Nullable JContainer<J2> withElementsNullable(@Nullable @Nullable JContainer<J2> before, @Nullable @Nullable java.util.List<J2> elements)
-
withElements
public static <J2 extends J> JContainer<J2> withElements(JContainer<J2> before, @Nullable @Nullable java.util.List<J2> elements)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-