Package io.wcm.handler.media
Interface Asset
-
- All Superinterfaces:
org.apache.sling.api.adapter.Adaptable
@ProviderType public interface Asset extends org.apache.sling.api.adapter.Adaptable
Represents a media item that is referenced via aMediaRequest
and resolved viaMediaHandler
. It cannot be rendered directly, but contains references to renditions depending onMediaArgs
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @Nullable java.lang.String
getAltText()
@Nullable Rendition
getDefaultRendition()
Get the default rendition without specifying and media args.@Nullable java.lang.String
getDescription()
@Nullable Rendition
getDownloadRendition(@NotNull MediaArgs mediaArgs)
Get the first download rendition that matches the given media args.@Nullable Rendition
getImageRendition(@NotNull MediaArgs mediaArgs)
Get the first image rendition that matches the given media args.@Nullable java.lang.String
getPath()
Internal path pointing to media item, if it is stored in the JCR repository.@NotNull org.apache.sling.api.resource.ValueMap
getProperties()
@Nullable Rendition
getRendition(@NotNull MediaArgs mediaArgs)
Get the first rendition that matches the given media args.@Nullable java.lang.String
getTitle()
@NotNull UriTemplate
getUriTemplate(@NotNull UriTemplateType type)
Generate an URI template for the asset.
-
-
-
Method Detail
-
getTitle
@Nullable @Nullable java.lang.String getTitle()
- Returns:
- Title of media item
-
getAltText
@Nullable @Nullable java.lang.String getAltText()
- Returns:
- Alternative text for media item
-
getDescription
@Nullable @Nullable java.lang.String getDescription()
- Returns:
- Description for this media item
-
getPath
@Nullable @Nullable java.lang.String getPath()
Internal path pointing to media item, if it is stored in the JCR repository.- Returns:
- Repository path or null if not stored in repository
-
getProperties
@NotNull @NotNull org.apache.sling.api.resource.ValueMap getProperties()
- Returns:
- Properties of media item
-
getDefaultRendition
@Nullable @Nullable Rendition getDefaultRendition()
Get the default rendition without specifying and media args.- Returns:
Rendition
instance or null if no rendition exists
-
getRendition
@Nullable @Nullable Rendition getRendition(@NotNull @NotNull MediaArgs mediaArgs)
Get the first rendition that matches the given media args.- Parameters:
mediaArgs
- Media args to filter specific media formats or extensions.- Returns:
Rendition
for the first matching rendition or null if no match found.
-
getImageRendition
@Nullable @Nullable Rendition getImageRendition(@NotNull @NotNull MediaArgs mediaArgs)
Get the first image rendition that matches the given media args.- Parameters:
mediaArgs
- Media args to filter specific media formats or extensions.- Returns:
Rendition
for the first matching rendition or null if no match found.
-
getDownloadRendition
@Nullable @Nullable Rendition getDownloadRendition(@NotNull @NotNull MediaArgs mediaArgs)
Get the first download rendition that matches the given media args.- Parameters:
mediaArgs
- Media args to filter specific media formats or extensions.- Returns:
Rendition
for the first matching rendition or null if no match found.
-
getUriTemplate
@NotNull @NotNull UriTemplate getUriTemplate(@NotNull @NotNull UriTemplateType type)
Generate an URI template for the asset. The URI template ignores any resolving parameters like media formats and relates only to the original asset and the max. width/height of it's original rendition.- Parameters:
type
- URI template type- Returns:
- URI template
- Throws:
java.lang.UnsupportedOperationException
- if the original rendition is not an image or it is a vector image.
-
-