Class RenditionPatternPicker

java.lang.Object
com.adobe.acs.commons.dam.RenditionPatternPicker
All Implemented Interfaces:
com.day.cq.dam.api.RenditionPicker

@ProviderType public class RenditionPatternPicker extends Object implements com.day.cq.dam.api.RenditionPicker
RenditionPicker that picks Assets based on a Regex pattern that matches against Rendition names.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create an Asset Rendition Picker that will pick a Rendition by matching the supplied Regex pattern (as String).
    Create an Asset Rendition Picker that will pick a Rendition by matching the supplied Regex pattern.
  • Method Summary

    Modifier and Type
    Method
    Description
    final com.day.cq.dam.api.Rendition
    getRendition(com.day.cq.dam.api.Asset asset)
    Gets the rendition which matches against the constructor's Regex pattern.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RenditionPatternPicker

      public RenditionPatternPicker(String pattern)
      Create an Asset Rendition Picker that will pick a Rendition by matching the supplied Regex pattern (as String).
      Parameters:
      pattern - Regex pattern to match against Rendition names.
    • RenditionPatternPicker

      public RenditionPatternPicker(Pattern pattern)
      Create an Asset Rendition Picker that will pick a Rendition by matching the supplied Regex pattern.
      Parameters:
      pattern - Pattern used to find the Asset rendition
  • Method Details

    • getRendition

      public final com.day.cq.dam.api.Rendition getRendition(com.day.cq.dam.api.Asset asset)
      Gets the rendition which matches against the constructor's Regex pattern.

      If no matches are made and an Original exists, returns the Original.

      If no matches are made and an Original doesn't exist, return the first Rendition.

      Specified by:
      getRendition in interface com.day.cq.dam.api.RenditionPicker
      Parameters:
      asset - Asset whose Renditions will be selected.
      Returns:
      The first rendition whose name matches the supplied pattern (via constructor).