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 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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue