in src/main/java/org/apache/sling/scripting/core/impl/bundled/BundleRenderUnitFinderImpl.java [156:200]
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 (extension != null) {
if (method != null) {
matches.add(base + DOT + extension + DOT + method);
}
matches.add(base + DOT + extension);
}
if (method != null) {
matches.add(base + DOT + method);
matches.add(base + SLASH + method);
}
matches.add(base);
}
}
String base = resourceType.getType()
+ (resourceType.getVersion() != null ? SLASH + resourceType.getVersion() : "");
if (extension != null) {
if (method != null) {
matches.add(base + SLASH + resourceType.getResourceLabel() + DOT + extension + DOT + method);
}
matches.add(base + SLASH + resourceType.getResourceLabel() + DOT + extension);
}
if (method != null) {
matches.add(base + SLASH + method);
matches.add(base + SLASH + resourceType.getResourceLabel() + DOT + method);
}
if (extension != null) {
matches.add(base + SLASH + extension);
}
matches.add(base + SLASH + resourceType.getResourceLabel());
}
return Collections.unmodifiableList(matches);
}