Moving SesSimClassLoader to a pure templated class

This commit is contained in:
2017-11-20 09:50:13 +01:00
parent fe6eae9457
commit 480167b53f
6 changed files with 14 additions and 7 deletions

View File

@ -34,7 +34,7 @@ import java.util.logging.Logger;
*
* @author 7u83 <7u83@mail.ru>
*/
public class AutoTraderLoader extends SeSimClassLoader {
public class AutoTraderLoader extends SeSimClassLoader<AutoTraderInterface> {
private ArrayList<Class<AutoTraderInterface>> traders_cache = null;
@ -44,6 +44,7 @@ public class AutoTraderLoader extends SeSimClassLoader {
private ClassLoader cl;
@Override
public AutoTraderInterface newInstance(Class<?> cls) {
// ClassLoader cur = Thread.currentThread().getContextClassLoader();
// Thread.currentThread().setContextClassLoader(cl);

View File

@ -34,6 +34,12 @@ import java.util.ArrayList;
public class IndicatorLoader<T> extends SeSimClassLoader {
ArrayList<Class<T>> cache;
final Class<T> class_type;
public IndicatorLoader(Class<T> class_type){
this.class_type=class_type;
}
/**
* Get a list of all traders found in class path
@ -46,11 +52,11 @@ public class IndicatorLoader<T> extends SeSimClassLoader {
return cache;
}
Class<?> tube = null;
Class<?> tube ;
ArrayList<Class<?>> trl;
ArrayList<Class<T>> result = new ArrayList<>();
trl = getInstalledClasses(new ArrayList(), tube);
trl = getInstalledClasses(new ArrayList(), class_type);
for (Class<?> c : trl) {
result.add((Class<T>) c);
}

View File

@ -41,7 +41,7 @@ import java.util.logging.Level;
*
* @author 7u83 <7u83@mail.ru>
*/
public class SeSimClassLoader {
public class SeSimClassLoader <T>{
protected ArrayList<String> default_pathlist;