Package io.wcm.handler.media.format
Class MediaFormat
- java.lang.Object
-
- io.wcm.handler.media.format.MediaFormat
-
- All Implemented Interfaces:
Comparable<MediaFormat>
@ProviderType public final class MediaFormat extends Object implements Comparable<MediaFormat>
Media format.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intcompareTo(MediaFormat o)booleanequals(Object pObj)@Nullable StringgetDescription()longgetEffectiveMaxHeight()longgetEffectiveMaxWidth()longgetEffectiveMinHeight()longgetEffectiveMinWidth()String[]getExtensions()longgetFileSizeMax()longgetHeight()@NotNull StringgetLabel()longgetMaxHeight()longgetMaxWidth()DimensiongetMinDimension()Get minimum dimensions for media format.longgetMinHeight()longgetMinWidth()@NotNull StringgetName()org.apache.sling.api.resource.ValueMapgetProperties()longgetRanking()doublegetRatio()Returns the ratio defined in the media format definition.StringgetRatioDisplayString()Return display string for defined ratio.longgetRatioHeight()Deprecated.doublegetRatioHeightAsDouble()longgetRatioWidth()Deprecated.doublegetRatioWidthAsDouble()StringgetRenditionGroup()longgetWidth()inthashCode()booleanhasRatio()booleanisDownload()booleanisFixedDimension()Checks if the media format has a fixed width and height defined, and no min/max constraints.booleanisFixedHeight()Checks if the media format has a fixed height defined, and no min/max constraints.booleanisFixedWidth()Checks if the media format has a fixed width defined, and no min/max constraints.booleanisImage()booleanisInternal()StringtoString()
-
-
-
Method Detail
-
getName
@NotNull public @NotNull String getName()
- Returns:
- Media format name
-
getLabel
@NotNull public @NotNull String getLabel()
- Returns:
- Media format label
-
getDescription
@Nullable public @Nullable String getDescription()
- Returns:
- Media format description
-
getWidth
public long getWidth()
- Returns:
- Image width (px)
-
getMinWidth
public long getMinWidth()
- Returns:
- Min. image width (px)
-
getMaxWidth
public long getMaxWidth()
- Returns:
- Max. image width (px)
-
getHeight
public long getHeight()
- Returns:
- Image height (px)
-
getMinHeight
public long getMinHeight()
- Returns:
- Min. image height (px)
-
getMaxHeight
public long getMaxHeight()
- Returns:
- Max. image height (px)
-
getRatioWidth
@Deprecated public long getRatioWidth()
Deprecated.- Returns:
- Ration width (px)
-
getRatioHeight
@Deprecated public long getRatioHeight()
Deprecated.- Returns:
- Ration height (px)
-
getRatioWidthAsDouble
public double getRatioWidthAsDouble()
- Returns:
- Ration width (px)
-
getRatioHeightAsDouble
public double getRatioHeightAsDouble()
- Returns:
- Ration height (px)
-
getRatio
public double getRatio()
Returns the ratio defined in the media format definition. If no ratio is defined an the media format has a fixed with/height it is calculated automatically. Otherwise 0 is returned.- Returns:
- Ratio
-
getRatioDisplayString
public String getRatioDisplayString()
Return display string for defined ratio.- Returns:
- Display string or null if media format has no ratio.
-
hasRatio
public boolean hasRatio()
- Returns:
- true if the media format has ratio (calculated for fixed dimensions or defined in media format)
-
getFileSizeMax
public long getFileSizeMax()
- Returns:
- Max. file size (bytes)
-
getExtensions
public String[] getExtensions()
- Returns:
- Allowed file extensions
-
getRenditionGroup
public String getRenditionGroup()
- Returns:
- Rendition group id
-
isDownload
public boolean isDownload()
- Returns:
- Media assets with this format should be downloaded and not displayed directly
-
isInternal
public boolean isInternal()
- Returns:
- For internal use only (not displayed for user)
-
getRanking
public long getRanking()
- Returns:
- Ranking for auto-detection. Lowest value = highest priority.
-
isImage
public boolean isImage()
- Returns:
- Whether the format allows at least one image extension
-
isFixedWidth
public boolean isFixedWidth()
Checks if the media format has a fixed width defined, and no min/max constraints.- Returns:
- If the media format has a fixed dimension.
-
isFixedHeight
public boolean isFixedHeight()
Checks if the media format has a fixed height defined, and no min/max constraints.- Returns:
- If the media format has a fixed dimension.
-
isFixedDimension
public boolean isFixedDimension()
Checks if the media format has a fixed width and height defined, and no min/max constraints.- Returns:
- If the media format has a fixed dimension.
-
getEffectiveMinWidth
public long getEffectiveMinWidth()
- Returns:
- Effective min. image width (px). Takes widthMin and width into account.
-
getEffectiveMaxWidth
public long getEffectiveMaxWidth()
- Returns:
- Effective max. image width (px). Takes widthMax and width into account.
-
getEffectiveMinHeight
public long getEffectiveMinHeight()
- Returns:
- Effective min. image height (px). Takes heightMin and height into account.
-
getEffectiveMaxHeight
public long getEffectiveMaxHeight()
- Returns:
- Effective max. image height (px). Takes heightMax and height into account.
-
getMinDimension
public Dimension getMinDimension()
Get minimum dimensions for media format. If only with or height is defined the missing dimensions is calculated from the ratio. If no ratio defined either only width or height dimension is returned. If neither width or height are defined null is returned.- Returns:
- Min. dimensions or null
-
getProperties
public org.apache.sling.api.resource.ValueMap getProperties()
- Returns:
- Custom properties that my be used by application-specific markup builders or processors.
-
toString
public String toString()
-
compareTo
public int compareTo(MediaFormat o)
- Specified by:
compareToin interfaceComparable<MediaFormat>
-
-