Class PathGenerator
- java.lang.Object
-
- org.apache.sling.resourceresolver.impl.mapping.PathGenerator
-
public class PathGenerator extends Object
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 Constructor Description PathGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
generatePaths()
Generates all possible pathsvoid
insertSegment(@NotNull List<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
-
-
-
Method Detail
-
insertSegment
public void insertSegment(@NotNull @NotNull List<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
public void setResolutionPathInfo(@Nullable @Nullable String resolutionInfo)
Sets the resolution info, to be appended at the end- Parameters:
resolutionInfo
- the resolution info to append, ignored if null or empty
-
-