Class MediaComponentPropertyResolver

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    @ProviderType
    public final class MediaComponentPropertyResolver
    extends java.lang.Object
    implements java.lang.AutoCloseable
    Resolves Media Handler component properties for the component associated with the given resource from content policies and properties defined in the component resource. Please make sure to close() instances of this class after usage.

    Alternatively, it's possible to use the resolver on a ValueMap. In this case, the properties are directly read from the provided value map. Picture Sources are not supported for that option.

    • Constructor Detail

      • MediaComponentPropertyResolver

        public MediaComponentPropertyResolver​(@NotNull
                                              @NotNull org.apache.sling.api.resource.Resource resource,
                                              @NotNull
                                              @NotNull io.wcm.wcm.commons.component.ComponentPropertyResolverFactory componentPropertyResolverFactory)
        Resolves
        Parameters:
        resource - Resource
        componentPropertyResolverFactory - Component property resolver factory
      • MediaComponentPropertyResolver

        public MediaComponentPropertyResolver​(@NotNull
                                              @NotNull org.apache.sling.api.resource.ValueMap valueMap)
        Parameters:
        valueMap - Value map to read properties directly from
    • Method Detail

      • isAutoCrop

        public boolean isAutoCrop()
        Returns:
        AutoCrop state
      • getMediaFormatOptions

        @NotNull
        public @NotNull MediaArgs.MediaFormatOption @Nullable [] getMediaFormatOptions()
        Returns:
        List of media formats with and without mandatory setting.
      • getMediaFormatNames

        @NotNull
        public @NotNull java.lang.String @Nullable [] getMediaFormatNames()
        Returns:
        List of media formats with and without mandatory setting.
      • getMandatoryMediaFormatNames

        @NotNull
        public @NotNull java.lang.String @Nullable [] getMandatoryMediaFormatNames()
        Returns:
        List of media formats with and without mandatory setting.
      • getImageSizes

        @Nullable
        public @Nullable MediaArgs.ImageSizes getImageSizes()
        Returns:
        Image sizes
      • getPictureSources

        @NotNull
        public @NotNull MediaArgs.PictureSource @Nullable [] getPictureSources()
        Returns:
        List of picture sources
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable