AutoTraderLoader uses SeSimClassLoader
This commit is contained in:
parent
b5d9c989f6
commit
cb98e7cc0f
@ -1,4 +1,4 @@
|
|||||||
#Tue, 21 Nov 2017 11:54:07 +0100
|
#Thu, 23 Nov 2017 21:55:11 +0100
|
||||||
annotation.processing.enabled=true
|
annotation.processing.enabled=true
|
||||||
annotation.processing.enabled.in.editor=false
|
annotation.processing.enabled.in.editor=false
|
||||||
annotation.processing.processors.list=
|
annotation.processing.processors.list=
|
||||||
|
@ -152,7 +152,7 @@ public class Globals {
|
|||||||
|
|
||||||
SeSimClassLoader<Indicator> il = new SeSimClassLoader<>(Indicator.class);
|
SeSimClassLoader<Indicator> il = new SeSimClassLoader<>(Indicator.class);
|
||||||
il.setDefaultPathList(default_pathlist);
|
il.setDefaultPathList(default_pathlist);
|
||||||
ArrayList<Class<Indicator>>ires = il.getInstalled();
|
ArrayList<Class<Indicator>>ires = il.getInstalledClasses();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,19 +72,7 @@ public class AutoTraderLoader extends SeSimClassLoader<AutoTraderInterface> {
|
|||||||
*/
|
*/
|
||||||
public ArrayList<Class<AutoTraderInterface>> getInstalledTraders() {
|
public ArrayList<Class<AutoTraderInterface>> getInstalledTraders() {
|
||||||
|
|
||||||
if (traders_cache != null) {
|
return getInstalledClasses(new ArrayList<String>());
|
||||||
return traders_cache;
|
|
||||||
}
|
|
||||||
|
|
||||||
ArrayList<Class<?>> trl;
|
|
||||||
ArrayList<Class<AutoTraderInterface>> result = new ArrayList<>();
|
|
||||||
trl = getInstalledClasses(new ArrayList());
|
|
||||||
for (Class<?> c : trl) {
|
|
||||||
result.add((Class<AutoTraderInterface>) c);
|
|
||||||
}
|
|
||||||
|
|
||||||
traders_cache = result;
|
|
||||||
return traders_cache;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,9 +30,14 @@ import java.util.ArrayList;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author 7u83 <7u83@mail.ru>
|
* @author 7u83 <7u83@mail.ru>
|
||||||
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
public class IndicatorLoader<T> extends SeSimClassLoader {
|
public class IndicatorLoader<T> extends SeSimClassLoader {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param class_type
|
||||||
|
*/
|
||||||
public IndicatorLoader(Class class_type) {
|
public IndicatorLoader(Class class_type) {
|
||||||
super(class_type);
|
super(class_type);
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@ public class SeSimClassLoader<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a SeSimClassLoader object with an empty default path
|
* Create a SeSimClassLoader object with an empty default path
|
||||||
|
*
|
||||||
* @param class_type
|
* @param class_type
|
||||||
*/
|
*/
|
||||||
public SeSimClassLoader(Class<T> class_type) {
|
public SeSimClassLoader(Class<T> class_type) {
|
||||||
@ -191,14 +192,9 @@ public class SeSimClassLoader<T> {
|
|||||||
* @param additional_pathlist
|
* @param additional_pathlist
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ArrayList<Class<T>> getInstalledClasses(ArrayList<String> additional_pathlist){
|
public ArrayList<Class<T>> getInstalledClasses0(ArrayList<String> pathlist) {
|
||||||
|
|
||||||
|
|
||||||
ArrayList<Class<T>> result = new ArrayList<>();
|
ArrayList<Class<T>> result = new ArrayList<>();
|
||||||
ArrayList<String> pathlist = new ArrayList<>();
|
|
||||||
|
|
||||||
pathlist.addAll(default_pathlist);
|
|
||||||
pathlist.addAll(additional_pathlist);
|
|
||||||
|
|
||||||
for (String path : pathlist) {
|
for (String path : pathlist) {
|
||||||
|
|
||||||
@ -272,18 +268,28 @@ public class SeSimClassLoader<T> {
|
|||||||
/**
|
/**
|
||||||
* Get a list of all traders found in class path
|
* Get a list of all traders found in class path
|
||||||
*
|
*
|
||||||
* @return List of traders
|
* @param additional_pathlist
|
||||||
|
* @return List of installed Clases
|
||||||
*/
|
*/
|
||||||
public ArrayList<Class<T>> getInstalled() {
|
public ArrayList<Class<T>> getInstalledClasses(ArrayList<String> additional_pathlist ) {
|
||||||
|
|
||||||
if (cache != null) {
|
if (cache != null) {
|
||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
cache = getInstalledClasses(new ArrayList());
|
ArrayList<String> pathlist;
|
||||||
|
pathlist = new ArrayList<>();
|
||||||
|
|
||||||
|
pathlist.addAll(default_pathlist);
|
||||||
|
pathlist.addAll(additional_pathlist);
|
||||||
|
|
||||||
|
cache = getInstalledClasses0(pathlist);
|
||||||
|
|
||||||
return cache;
|
return cache;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList<Class<T>> getInstalledClasses(){
|
||||||
|
return getInstalledClasses(new ArrayList<>());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user