Added the possibility to exclude is model package
This commit is contained in:
parent
b36310c650
commit
1fdadfb170
|
@ -31,20 +31,31 @@ public class ElementSpecilizationDiscovery<E extends Element> {
|
||||||
protected final Class<E> root;
|
protected final Class<E> root;
|
||||||
protected final List<Package> packages;
|
protected final List<Package> packages;
|
||||||
protected final List<Class<? extends E>> discovered;
|
protected final List<Class<? extends E>> discovered;
|
||||||
|
protected final boolean includeRootPackage;
|
||||||
|
|
||||||
public List<Class<? extends E>> getDiscovered() {
|
public List<Class<? extends E>> getDiscovered() {
|
||||||
return discovered;
|
return discovered;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElementSpecilizationDiscovery(Class<E> root) {
|
public ElementSpecilizationDiscovery(Class<E> root) {
|
||||||
|
this(root, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ElementSpecilizationDiscovery(Class<E> root, boolean includeRootPackage) {
|
||||||
this.root = root;
|
this.root = root;
|
||||||
this.packages = new ArrayList<>();
|
this.packages = new ArrayList<>();
|
||||||
addPackage(root.getPackage());
|
this.includeRootPackage = includeRootPackage;
|
||||||
|
if(includeRootPackage) {
|
||||||
|
addPackage(root.getPackage());
|
||||||
|
}
|
||||||
this.discovered = new ArrayList<>();
|
this.discovered = new ArrayList<>();
|
||||||
add(root);
|
add(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPackage(Package p) {
|
public void addPackage(Package p) {
|
||||||
|
if(!includeRootPackage && p==root.getPackage()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
packages.add(p);
|
packages.add(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue