Class PathGenerator
java.lang.Object
org.apache.sling.resourceresolver.impl.mapping.PathGenerator
Utility to generate all possible paths from segments (names)
This class expects to be supplied segments starting with the top-most ones (leaves) up until, but excluding, the root.
It generates all possible path combinations using a cartesian product that accummulates
using a StringBuilder
instead of a set, to prevent intermediate object creation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGenerates all possible pathsvoid
insertSegment
(@NotNull Collection<String> alias, @NotNull String name) Inserts a new segment as the parent of the existing onesvoid
setResolutionPathInfo
(@Nullable String resolutionInfo) Sets the resolution info, to be appended at the end
-
Constructor Details
-
PathGenerator
public PathGenerator()
-
-
Method Details
-
insertSegment
public void insertSegment(@NotNull @NotNull Collection<String> alias, @NotNull @NotNull String name) Inserts a new segment as the parent of the existing ones- Parameters:
alias
- the list of aliasesname
- the name
-
setResolutionPathInfo
Sets the resolution info, to be appended at the end- Parameters:
resolutionInfo
- the resolution info to append, ignored if null or empty
-
generatePaths
Generates all possible paths- Returns:
- a list of paths containing at least one entry
-