Added the possibility to exclude is model package

This commit is contained in:
Luca Frosini 2023-01-24 19:23:02 +01:00
parent b36310c650
commit 1fdadfb170
1 changed files with 12 additions and 1 deletions

View File

@ -31,20 +31,31 @@ public class ElementSpecilizationDiscovery<E extends Element> {
protected final Class<E> root;
protected final List<Package> packages;
protected final List<Class<? extends E>> discovered;
protected final boolean includeRootPackage;
public List<Class<? extends E>> getDiscovered() {
return discovered;
}
public ElementSpecilizationDiscovery(Class<E> root) {
this(root, true);
}
public ElementSpecilizationDiscovery(Class<E> root, boolean includeRootPackage) {
this.root = root;
this.packages = new ArrayList<>();
addPackage(root.getPackage());
this.includeRootPackage = includeRootPackage;
if(includeRootPackage) {
addPackage(root.getPackage());
}
this.discovered = new ArrayList<>();
add(root);
}
public void addPackage(Package p) {
if(!includeRootPackage && p==root.getPackage()) {
return;
}
packages.add(p);
}