Skip to content

Commit

Permalink
Merge pull request #514 from exadel-inc/feature/EAK-513
Browse files Browse the repository at this point in the history
[EAK-513] Added the ability to specify comma-separated componentsReferenceBase values
  • Loading branch information
smiakchilo authored Feb 12, 2024
2 parents 6d8ff16 + 9d3f0fe commit e307686
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/content/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ seoTitle: Installation - Exadel Authoring Kit
<configuration>
<!-- RECOMMENDED: Place here the path to the node under which your component nodes are stored -->
<componentsPathBase>jcr_root/apps/acme/components</componentsPathBase>
<!-- RECOMMENDED: Specify root package for component classes that match the current package -->
<!-- RECOMMENDED: Specify root package for component classes that match the current package. Multiple values can be separated with a comma -->
<componentsReferenceBase>com.acme.project.components.*</componentsReferenceBase>
<!-- OPTIONAL: specify list of exceptions that would cause this plugin to terminate -->
<terminateOn>ALL</terminateOn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
*/
public class ReflectionContextHelper {

private static final char SEPARATOR_COMMA = ',';
private Reflections reflections;

private ClassLoader classLoader;
Expand Down Expand Up @@ -101,9 +102,10 @@ public ClassLoader getClassLoader() {
* @return A non-null list of {@code ComponentSource} objects; can be empty
*/
public List<ComponentSource> getComponents(String packageBase) {
String[] packageRoots = StringUtils.split(packageBase, SEPARATOR_COMMA);
return getComponents()
.stream()
.filter(comp -> StringUtils.isEmpty(packageBase) || ClassUtil.matchesReference(comp.adaptTo(Class.class), packageBase))
.filter(comp -> StringUtils.isEmpty(packageBase) || ClassUtil.matchesReference(comp.adaptTo(Class.class), packageRoots))
.collect(Collectors.toList());
}

Expand Down

0 comments on commit e307686

Please sign in to comment.