Class CandidateTargetIdsResolverImpl
- java.lang.Object
-
- org.craftercms.engine.targeting.impl.CandidateTargetIdsResolverImpl
-
- All Implemented Interfaces:
CandidateTargetIdsResolver
public class CandidateTargetIdsResolverImpl extends Object implements CandidateTargetIdsResolver
Default implementation ofCandidateTargetIdsResolver
, 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 Summary
Fields Modifier and Type Field Description static String
DEFAULT_TARGET_ID_SEPARATOR
protected String
targetIdSeparator
-
Constructor Summary
Constructors Constructor Description CandidateTargetIdsResolverImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
getTargetIds(String targetId, String fallbackTargetId)
Resolves the target IDs to use to build the candidate targeted URLs.void
setTargetIdSeparator(String targetIdSeparator)
-
-
-
Field Detail
-
DEFAULT_TARGET_ID_SEPARATOR
public static final String DEFAULT_TARGET_ID_SEPARATOR
- See Also:
- Constant Field Values
-
targetIdSeparator
protected String targetIdSeparator
-
-
Method Detail
-
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 interfaceCandidateTargetIdsResolver
- Parameters:
targetId
- the target ID from where to resolve the candidate target IDsfallbackTargetId
- the last candidate target ID to use- Returns:
- the list of candidate target IDs
-
-