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

    • Method Detail

      • 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()
      • 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()
      • 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 JJContainer<J2> withElements​(JContainer<J2> before,
                                                                 @Nullable
                                                                 @Nullable java.util.List<J2> elements)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object