T domainObject = this.domainType.newInstance();
Does not work with not public constructor.
Which is common with JPA, because default constructor is needed but not wanted.
3 possible Options;
Give the GridCrud an option to provide a new instance supplier.
protected void addNewInstanceSupplier(Supplier supplier){
return this.supplier;
}
T domainObject = this.supplier.get(); // default supplier can still be this.domainType.newInstance();
Make a method that provides a new instance that can be overridden
protected T createdNewInstance(){
T domainObject = this.domainType.newInstance();
} // gives people the change to use a builder or just construct an object.
use reflection to make it accessible, when it's not accessible.
https://github.com/alejandro-du/crudui/blob/9cf20e1dde4e79058b72d9203a8e39a0725dabf0/add-on/src/main/java/org/vaadin/crudui/crud/impl/GridCrud.java#L168
T domainObject = this.domainType.newInstance(); Does not work with not public constructor.
Which is common with JPA, because default constructor is needed but not wanted.
3 possible Options;
T domainObject = this.supplier.get(); // default supplier can still be this.domainType.newInstance();
Make a method that provides a new instance that can be overridden protected T createdNewInstance(){ T domainObject = this.domainType.newInstance(); } // gives people the change to use a builder or just construct an object.
use reflection to make it accessible, when it's not accessible.