java.lang.Object
org.springframework.web.reactive.result.view.Fragment

public final class Fragment extends Object
Container for a model and a view for use with FragmentsRendering and multi-view rendering. For full page rendering with a single model and view, use Rendering.
Since:
6.2
Author:
Rossen Stoyanchev
See Also:
  • Method Details

    • isResolved

      public boolean isResolved()
      Whether this Fragment contains a resolved View instance.
    • viewName

      @Nullable public String viewName()
      Return the view name of the Fragment, or null if not set.
    • view

      public View view()
      Return the resolved View instance. This should be called only after an isResolved() check.
    • model

      public Map<String,Object> model()
      Return the model for this Fragment, or an empty map.
    • mergeAttributes

      public void mergeAttributes(Model model)
      Merge attributes from the request model if not already present.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • create

      public static Fragment create(String viewName, Map<String,Object> model)
      Create a Fragment with a view name and a model, also inheriting model attributes from the top-level model for the request.
    • create

      public static Fragment create(String viewName)
      Create a Fragment with a view name only, inheriting model attributes from the top-level model for the request.
    • create

      public static Fragment create(View view, Map<String,Object> model)
      Variant of create(String, Map) with a resolved View.