Interface MediaMarkupBuilder

All Known Implementing Classes:
AbstractImageMediaMarkupBuilder, DamVideoMediaMarkupBuilder, DummyImageMediaMarkupBuilder, SimpleImageMediaMarkupBuilder

@ConsumerType public interface MediaMarkupBuilder
Builds XHTML markup for media element.

This interface has to be implemented by a Sling Model class. The adaptables should be SlingHttpServletRequest and Resource.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final @NotNull String
    Dummy image
    static final int
    Try to render dummy image with least with this dimension.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    accepts(@NotNull Media media)
    Checks whether this builder can generate markup for the given media.
    @Nullable io.wcm.handler.commons.dom.HtmlElement
    build(@NotNull Media media)
    Build media element markup
    boolean
    isValidMedia(@NotNull io.wcm.handler.commons.dom.HtmlElement element)
    Checks if the given HTML element is valid.
  • Field Details

    • DUMMY_IMAGE

      @NotNull static final @NotNull String DUMMY_IMAGE
      Dummy image
      See Also:
    • DUMMY_MIN_DIMENSION

      static final int DUMMY_MIN_DIMENSION
      Try to render dummy image with least with this dimension.
      See Also:
  • Method Details

    • accepts

      boolean accepts(@NotNull @NotNull Media media)
      Checks whether this builder can generate markup for the given media.
      Parameters:
      media - Media metadata
      Returns:
      true if this markup builder can handle the given media
    • build

      @Nullable @Nullable io.wcm.handler.commons.dom.HtmlElement build(@NotNull @NotNull Media media)
      Build media element markup
      Parameters:
      media - Media metadata
      Returns:
      Media element or null if media is invalid
    • isValidMedia

      boolean isValidMedia(@NotNull @NotNull io.wcm.handler.commons.dom.HtmlElement element)
      Checks if the given HTML element is valid. It is treated as invalid if it is null, or if it is a simple IMG element containing the dummy image.
      Parameters:
      element - Media markup element.
      Returns:
      true if media element is invalid