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 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.

  • Method Details

    • build

      public static <T> JContainer<T> build(List<JRightPadded<T>> elements)
    • build

      public static <T> JContainer<T> build(@Nullable Space before, @Nullable List<JRightPadded<T>> elements, @Nullable 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 List<T> getElements()
    • getBefore

      public Space getBefore()
    • map

      public JContainer<T> map(UnaryOperator<T> map)
    • getLastSpace

      public Space getLastSpace()
    • getPadding

      public JContainer.Padding<T> getPadding()
    • withElementsNullable

      public static <J2 extends org.openrewrite.java.tree.J> @Nullable JContainer<J2> withElementsNullable(@Nullable JContainer<J2> before, @Nullable List<J2> elements)
    • withElements

      public static <J2 extends org.openrewrite.java.tree.J> JContainer<J2> withElements(JContainer<J2> before, @Nullable List<J2> elements)
    • toString

      public String toString()
      Overrides:
      toString in class Object