Open deepu105 opened 6 years ago
what about having also a way to implement the generation gap pattern like this:
@Incomplete entity AddressEntity { ... }
we would generate:
AbstractAddressEntity
every time the generator is executed and this class would contain everything is needed to persist an entity (like it is already)AddressEntity extends AbstractAddressEntity
) but only once (or if it was deleted). This class is mainly empty and thought to be enhanced by developers manually.The idea behind is that developers could enhance the concrete class with their own code without losing the manually entered code when regenerating.
Of course, they would also be able to overload the generated code in the abstract class partially or completeley which gives developers the maximal flexibility. Obviousely, methods that for what every reason we would not allow to overload must be declared as private.
...and btw, this would also work with inheritance, because:
@Incomplete entity AddressEntity extends BaseEntity {}
we would generateclass BaseEntitiy {}
and aclass AbstractAddressEntity {}
which would inherit from BaseEntitiy{}
class AddressEntity
would inherit from AbstractAddressEntity
only@colameo that's the idea but I wouldn't want to go too far, the extends in JDL will only extend the config of JDL and will not create extends in the output code. Instead of annotating entities as @incomplete
it could be an application level property to enable the behavior as you would want to edit most of your entities anyway. The fine grain control can be a later feature. I would like to get an MVP first and then improve it
@colameo I have talked about that in the mailing list btw
Any progress on Inheritance? It is a great feature.
To make JHipster more JDL centric and to truly achieve scaffolding as Code I envision the below. Detailed explanation of the vision is in this mailing list entry, this ticket only covers the JDL part
If everyone agrees, I would like to drive this for v6
Note: This is not addressing the side by side or code upgrade issues as I believe they need to solved through architecture of generated code and from the generator rather than through JDL, and I don't want to bring in that discussion here. It will be discussed in the mailing list entry
For a detailed discussion about the rationale behind some of the considerations check these older issues #141 and https://github.com/jhipster/generator-jhipster/issues/6275
Entities
current
enhanced
Entities can be defined at
Service
Services can be abstract or concrete, same rules as entity.
Application
current
enhanced
Deployments
Already WIP: #276. Deployments can be declared so that their configuration etc are generated. An application can declare multiple deployments
Other improvements