jeudi 9 mai 2019

How to create new object in GWT by string class-name?

My goal is to create a flexible application-> to extend the functionality of my web-application I only to add a position to the database and upload the missing class to the server.

I created dynamic menu in Java-GWT. I use MenuBar() and loops, all positions, wchich were taken from db (array, string). Of course, 'end-option' in menu must do something, generally after clicking application will open i.e. FlowPanel with buttons, labels, textareas.

My idea was: using java reflection to add Command for all positions in menu. Every Command take name of option (string), name is the same, like name of class -> next, after clicking I will automatically create object. Unfortunatelly Java Reflection don't work with GWT, so this way is not possible.

My question is:

How to create object, when I have class name in string? Or if my idea is wrong, maybye is other way to create flexible menu/program?





Aucun commentaire:

Enregistrer un commentaire