sane-city / wot-servient

W3C Web of Things implementation for Java
MIT License
29 stars 5 forks source link

Generate Things #44

Open LeebPhil opened 2 years ago

LeebPhil commented 2 years ago

Hey guys,

idk if the title fits the problem and please change if it's not matching the problem.
But i wanted to know if there is a convenient way to generate multiple Things. I implemented my Things as basic Java classes with a constructor where i pass the path of config-file and generate the object. So i created a Main class which looks like:

public class Main {

    public static void main(String[] args) {
        new MyThingService("src/main/resources/thing.conf");
        new MyThing("src/main/resources/ammeter.conf");
        new MyThing("src/main/resources/bla.conf");
    }

}

The first object of MyThing gets constructed and exposed, the second one not. If i create a second class with a main method:

public class SecMain {
    public static void main(String[] args) {
        new MyThing("src/main/resources/bla.conf");
    }
}  

it works... Is it possible to create multiple things (of one class) in one main?

Kind regards,
Phil