Setting value of controller controls for domain objects with Reflection
Is my use of Java Reflection an OK design?

Well, no, the usage of reflection is usually an indication of bad design. Honestly, it is almost always. Actually, you have to change the question and ask, when is it okay, to use reflection. The answer is something similar like this: Use reflection, when you do not know how a class looks like during runtime. But this is your code, so, why would you increase complexity and make your code more error prone?



In general, I have some worries, when I read the code:

@Node(name = "lastNameField", type = TextField.class)
private StringProperty lastName = new SimpleStringProperty();


Now, it might be a language or a definition subject, but if Employee is a domain model, it must not have dependencies to the view layer, at least no direct dependencies.



@Edit(controller = EmployeeController.class)
public class Employee extends Item {


The Employee itself is in control, of who controls itself. Shouldn't you tell the EmployeController, which model it shall edit?



Double-clicking on a ListCell would call .edit() on the domain object.

Same thing. The presentation code calls the domain object, then, the domain objects calls someone and says "someone wants to edit me". If I understood it correctly.


There's some other fishy stuff, but I'll conclude now, because in my opinion there are some problems even without the reflection stuff: It seems like an over engineered approach for an easy problem. Or: It looks like the solution of a problem, which probably isn't even a problem. It certainly is, from my point of view, the wrong tool for "the problem". The usage of reflection makes maintaining the code harder and more error prone, at least in my experience. The usage of annotations, too, by the way.

I'd suggest to take a step back to the solution before you implemented reflection and analyze what object oriented principles are violated (e.g. SOLID, coupling, cohesion,...) and what patterns can help you get rid of those problems. Now, that's the major point: Ask what design patterns help you get rid of your design problems, do not ask would reflection get rid of the design problems?.

I recommend fowler's web page about gui architectures: https://martinfowler.com/eaaDev/ (presentation patterns). It's not exactly a "good read", but it certainly is educational. It helps you to understand, which presentation patterns suits your application best and gives you some guidelines about how to implement you presentation layer.