mirror of
https://github.com/Telecominfraproject/wlan-cloud-base.git
synced 2026-01-27 10:22:34 +00:00
fixed registration of vendor extensions with BaseJsonModel
This commit is contained in:
@@ -126,8 +126,10 @@ public abstract class BaseJdbcTest {
|
||||
urls.addAll(ClasspathHelper.forPackage("com.telecominfraproject.wlan"));
|
||||
|
||||
//add vendor packages
|
||||
if(BaseJsonModel.vendorTopLevelPackages!=null) {
|
||||
String[] vendorPkgs = BaseJsonModel.vendorTopLevelPackages.split(",");
|
||||
String vendorTopLevelPackages = BaseJsonModel.getVendorTopLevelPackages();
|
||||
|
||||
if(vendorTopLevelPackages!=null) {
|
||||
String[] vendorPkgs = vendorTopLevelPackages.split(",");
|
||||
for(int i=0; i< vendorPkgs.length; i++) {
|
||||
if(vendorPkgs[i].trim().isEmpty()) {
|
||||
continue;
|
||||
|
||||
@@ -224,7 +224,10 @@ public abstract class BaseJsonModel implements Cloneable, Serializable {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static final String vendorTopLevelPackages = System.getProperty("tip.wlan.vendorTopLevelPackages", "");
|
||||
public static String getVendorTopLevelPackages() {
|
||||
return System.getProperty("tip.wlan.vendorTopLevelPackages", "");
|
||||
}
|
||||
|
||||
public static Reflections getReflections() {
|
||||
//scan urls that contain 'com.telecominfraproject.wlan' and vendor-specific top level packages, use the default scanners
|
||||
|
||||
@@ -235,6 +238,8 @@ public abstract class BaseJsonModel implements Cloneable, Serializable {
|
||||
pkgs.add("com.telecominfraproject.wlan");
|
||||
|
||||
//add vendor packages
|
||||
String vendorTopLevelPackages = getVendorTopLevelPackages();
|
||||
|
||||
if(vendorTopLevelPackages!=null) {
|
||||
String[] vendorPkgs = vendorTopLevelPackages.split(",");
|
||||
for(int i=0; i< vendorPkgs.length; i++) {
|
||||
@@ -249,8 +254,10 @@ public abstract class BaseJsonModel implements Cloneable, Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
FilterBuilder filters = new FilterBuilder().includePackage(pkgs.toArray(new String[0]));
|
||||
|
||||
Reflections reflections = new Reflections(new ConfigurationBuilder()
|
||||
.filterInputsBy(new FilterBuilder().includePackage(pkgs.toArray(new String[0])))
|
||||
.filterInputsBy(filters)
|
||||
.setUrls(urls)
|
||||
.setScanners(new SubTypesScanner(), new TypeAnnotationsScanner() ));
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class FilterBuilder implements Predicate<String> {
|
||||
/** include packages of given prefixes */
|
||||
public FilterBuilder includePackage(final String... prefixes) {
|
||||
for (String prefix : prefixes) {
|
||||
return add(new Include(prefix(prefix)));
|
||||
add(new Include(prefix(prefix)));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user