Class CandidateTargetIdsResolverImpl

java.lang.Object
org.craftercms.engine.targeting.impl.CandidateTargetIdsResolverImpl
All Implemented Interfaces:
CandidateTargetIdsResolver

public class CandidateTargetIdsResolverImpl extends Object implements CandidateTargetIdsResolver
Default implementation of CandidateTargetIdsResolver, which generates the candidate target IDs by splitting the original target ID and appending the components again but excluding the last one on each iteration. For example, if the original target ID is ja_JP_JP and the fallback target ID is en, the the candidate targetd IDs will be: ja_JP_JP, ja_JP, ja and en.
Author:
avasquez
  • Field Details

    • DEFAULT_TARGET_ID_SEPARATOR

      public static final String DEFAULT_TARGET_ID_SEPARATOR
      See Also:
    • targetIdSeparator

      protected String targetIdSeparator
  • Constructor Details

    • CandidateTargetIdsResolverImpl

      public CandidateTargetIdsResolverImpl()
  • Method Details

    • setTargetIdSeparator

      public void setTargetIdSeparator(String targetIdSeparator)
    • getTargetIds

      public List<String> getTargetIds(String targetId, String fallbackTargetId)
      Description copied from interface: CandidateTargetIdsResolver
      Resolves the target IDs to use to build the candidate targeted URLs. For example, if the specified target ID is es_CR, and the fallback target ID is en, then the candidate target IDs are: es_CR, es and en. An empty string will be added if the fallback target ID is empty or null.
      Specified by:
      getTargetIds in interface CandidateTargetIdsResolver
      Parameters:
      targetId - the target ID from where to resolve the candidate target IDs
      fallbackTargetId - the last candidate target ID to use
      Returns:
      the list of candidate target IDs