Project for Continous Integration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.2 KiB

import device.Device;
import java.io.FileReader;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.Properties;
public class BordComputer {
String[] deviceNames;
Device[] installedDevices;
Device activeDevice = null;
public void readConfig() {
try (FileReader reader = new FileReader("Geraete.config")) {
Properties properties = new Properties();
properties.load(reader);
String[] values = properties.values().toArray(new String[0]);
Arrays.sort(values);
deviceNames = new String[values.length];
System.arraycopy(values, 0, deviceNames, 0, properties.size());
installedDevices=new Device[values.length];
} catch (Exception e) {
e.printStackTrace();
}
activeDevice =installedDevices[0];
}
public void setDevices() throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException, ClassNotFoundException {
Class<?> c;
c= Class.forName(deviceNames[0]);
installedDevices[0] = (Device) c.getConstructor().newInstance();
}
}