Package io.wcm.handler.media.spi
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
andResource
.
-
-
Field Summary
Fields Modifier and Type Field Description static @NotNull java.lang.String
DUMMY_IMAGE
Dummy imagestatic int
DUMMY_MIN_DIMENSION
Try to render dummy image with least with this dimension.
-
Method Summary
All Methods Instance Methods Abstract Methods 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 markupboolean
isValidMedia(@NotNull io.wcm.handler.commons.dom.HtmlElement element)
Checks if the given HTML element is valid.
-
-
-
Field Detail
-
DUMMY_IMAGE
@NotNull static final @NotNull java.lang.String DUMMY_IMAGE
Dummy image- See Also:
- Constant Field Values
-
DUMMY_MIN_DIMENSION
static final int DUMMY_MIN_DIMENSION
Try to render dummy image with least with this dimension.- See Also:
- Constant Field Values
-
-
Method Detail
-
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
-
-