in src/main/java/org/apache/sling/scripting/core/impl/bundled/BundleRenderUnitFinderImpl.java [122:165]
private List<String> buildScriptMatches(@NotNull Set<ResourceType> resourceTypes, @NotNull String[] selectors, @Nullable String method,
@Nullable String extension) {
List<String> matches = new ArrayList<>();
for (ResourceType resourceType : resourceTypes) {
if (selectors.length > 0) {
for (int i = selectors.length - 1; i >= 0; i--) {
String base =
resourceType.getType() +
(resourceType.getVersion() != null ? SLASH + resourceType.getVersion() + SLASH :
SLASH) +
String.join(SLASH, Arrays.copyOf(selectors, i + 1));
if (StringUtils.isNotEmpty(extension)) {
if (StringUtils.isNotEmpty(method)) {
matches.add(base + DOT + extension + DOT + method);
}
matches.add(base + DOT + extension);
}
if (StringUtils.isNotEmpty(method)) {
matches.add(base + DOT + method);
matches.add(base + SLASH + method);
}
matches.add(base);
}
}
String base = resourceType.getType() +
(resourceType.getVersion() != null ? SLASH + resourceType.getVersion() : StringUtils.EMPTY);
if (StringUtils.isNotEmpty(extension)) {
if (StringUtils.isNotEmpty(method)) {
matches.add(base + SLASH + resourceType.getResourceLabel() + DOT + extension + DOT + method);
}
matches.add(base + SLASH + resourceType.getResourceLabel() + DOT + extension);
}
if (StringUtils.isNotEmpty(method)) {
matches.add(base + SLASH + method);
matches.add(base + SLASH + resourceType.getResourceLabel() + DOT + method);
}
if (StringUtils.isNotEmpty(extension)) {
matches.add(base + SLASH + extension);
}
matches.add(base + SLASH + resourceType.getResourceLabel());
}
return Collections.unmodifiableList(matches);
}