Package io.wcm.handler.media.format
Class MediaFormatBuilder
- java.lang.Object
-
- io.wcm.handler.media.format.MediaFormatBuilder
-
@ProviderType public final class MediaFormatBuilder extends java.lang.Object
Fluent API for building media format definitions.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull MediaFormat
build()
Builds the media format definition.static @NotNull MediaFormatBuilder
create(@NotNull java.lang.String name)
Create a new media format builder.@NotNull MediaFormatBuilder
description(java.lang.String value)
@NotNull MediaFormatBuilder
download(boolean value)
@NotNull MediaFormatBuilder
extensions(java.lang.String... value)
@NotNull MediaFormatBuilder
fileSizeMax(long value)
@NotNull MediaFormatBuilder
fixedDimension(long widthValue, long heightValue)
@NotNull MediaFormatBuilder
height(long value)
@NotNull MediaFormatBuilder
height(long min, long max)
@NotNull MediaFormatBuilder
internal(boolean value)
@NotNull MediaFormatBuilder
label(java.lang.String value)
@NotNull MediaFormatBuilder
maxHeight(long value)
@NotNull MediaFormatBuilder
maxWidth(long value)
@NotNull MediaFormatBuilder
minHeight(long value)
@NotNull MediaFormatBuilder
minWidth(long value)
@NotNull MediaFormatBuilder
minWidthHeight(long value)
@NotNull MediaFormatBuilder
properties(java.util.Map<java.lang.String,java.lang.Object> map)
Custom properties that my be used by application-specific markup builders or processors.@NotNull MediaFormatBuilder
property(java.lang.String key, java.lang.Object value)
Custom properties that my be used by application-specific markup builders or processors.@NotNull MediaFormatBuilder
ranking(int value)
@NotNull MediaFormatBuilder
ratio(double value)
@NotNull MediaFormatBuilder
ratio(double widthValue, double heightValue)
@NotNull MediaFormatBuilder
ratio(long widthValue, long heightValue)
@NotNull MediaFormatBuilder
renditionGroup(java.lang.String value)
@NotNull MediaFormatBuilder
width(long value)
@NotNull MediaFormatBuilder
width(long min, long max)
-
-
-
Method Detail
-
create
@NotNull public static @NotNull MediaFormatBuilder create(@NotNull @NotNull java.lang.String name)
Create a new media format builder.- Parameters:
name
- Media format name. Only characters, numbers, hyphen and underline are allowed.- Returns:
- Media format builder
-
label
@NotNull public @NotNull MediaFormatBuilder label(java.lang.String value)
- Parameters:
value
- Label for displaying to user- Returns:
- this
-
description
@NotNull public @NotNull MediaFormatBuilder description(java.lang.String value)
- Parameters:
value
- Description for displaying to user- Returns:
- this
-
width
@NotNull public @NotNull MediaFormatBuilder width(long value)
- Parameters:
value
- Fixed image width (px)- Returns:
- this
-
minWidth
@NotNull public @NotNull MediaFormatBuilder minWidth(long value)
- Parameters:
value
- Image width min (px)- Returns:
- this
-
maxWidth
@NotNull public @NotNull MediaFormatBuilder maxWidth(long value)
- Parameters:
value
- Image width max (px)- Returns:
- this
-
width
@NotNull public @NotNull MediaFormatBuilder width(long min, long max)
- Parameters:
min
- Image width min (px)max
- Image width max (px)- Returns:
- this
-
height
@NotNull public @NotNull MediaFormatBuilder height(long value)
- Parameters:
value
- Fixed image height (px)- Returns:
- this
-
minHeight
@NotNull public @NotNull MediaFormatBuilder minHeight(long value)
- Parameters:
value
- Image height min (px)- Returns:
- this
-
maxHeight
@NotNull public @NotNull MediaFormatBuilder maxHeight(long value)
- Parameters:
value
- Image height max (px)- Returns:
- this
-
height
@NotNull public @NotNull MediaFormatBuilder height(long min, long max)
- Parameters:
min
- Image height min (px)max
- Image height max (px)- Returns:
- this
-
minWidthHeight
@NotNull public @NotNull MediaFormatBuilder minWidthHeight(long value)
- Parameters:
value
- Min. width/height (px) - the longest edge is checked. Cannot be combined with other width/height restrictions.- Returns:
- this
-
fixedDimension
@NotNull public @NotNull MediaFormatBuilder fixedDimension(long widthValue, long heightValue)
- Parameters:
widthValue
- Fixed image width (px)heightValue
- Fixed image height (px)- Returns:
- this
-
ratio
@NotNull public @NotNull MediaFormatBuilder ratio(double value)
- Parameters:
value
- Ratio (width/height)- Returns:
- this
-
ratio
@NotNull public @NotNull MediaFormatBuilder ratio(long widthValue, long heightValue)
- Parameters:
widthValue
- Ratio width sample value (is used for calculating the ratio together with ratioHeight, and for display)heightValue
- Ratio height sample value (is used for calculating the ratio together with ratioWidth, and for display)- Returns:
- this
-
ratio
@NotNull public @NotNull MediaFormatBuilder ratio(double widthValue, double heightValue)
- Parameters:
widthValue
- Ratio width sample value (is used for calculating the ratio together with ratioHeight, and for display)heightValue
- Ratio height sample value (is used for calculating the ratio together with ratioWidth, and for display)- Returns:
- this
-
fileSizeMax
@NotNull public @NotNull MediaFormatBuilder fileSizeMax(long value)
- Parameters:
value
- Max. file size (bytes)- Returns:
- this
-
extensions
@NotNull public @NotNull MediaFormatBuilder extensions(java.lang.String... value)
- Parameters:
value
- Allowed file extensions- Returns:
- this
-
renditionGroup
@NotNull public @NotNull MediaFormatBuilder renditionGroup(java.lang.String value)
- Parameters:
value
- Rendition group id- Returns:
- this
-
download
@NotNull public @NotNull MediaFormatBuilder download(boolean value)
- Parameters:
value
- Media assets with this format should be downloaded and not displayed directly- Returns:
- this
-
internal
@NotNull public @NotNull MediaFormatBuilder internal(boolean value)
- Parameters:
value
- For internal use only (not displayed for user)- Returns:
- this
-
ranking
@NotNull public @NotNull MediaFormatBuilder ranking(int value)
- Parameters:
value
- Ranking for controlling priority in auto-detection. Lowest value = highest priority.- Returns:
- this
-
properties
@NotNull public @NotNull MediaFormatBuilder properties(java.util.Map<java.lang.String,java.lang.Object> map)
Custom properties that my be used by application-specific markup builders or processors.- Parameters:
map
- Property map. Is merged with properties already set in builder.- Returns:
- this
-
property
@NotNull public @NotNull MediaFormatBuilder property(java.lang.String key, java.lang.Object value)
Custom properties that my be used by application-specific markup builders or processors.- Parameters:
key
- Property keyvalue
- Property value- Returns:
- this
-
build
@NotNull public @NotNull MediaFormat build()
Builds the media format definition.- Returns:
- Media format definition
-
-