Closed vw98075 closed 2 months ago
Add this to .blueprint/app/generator.mjs
file.
import BaseApplicationGenerator from 'generator-jhipster/generators/base-application';
export default class extends BaseApplicationGenerator {
constructor(args, opts, features) {
super(args, opts, { ...features, sbsBlueprint: true });
}
get [BaseApplicationGenerator.POST_WRITING]() {
return this.asPostWritingTaskGroup({
async postWritingTemplateTask() {
this.queueTransformStream(async function* (generator) {
for await (const file of generator) {
if (file.path.endsWith('.java') && !file.path.includes('test')) {
file.contents = Buffer.from(file.contents.toString().replaceAll('private', 'protected'));
}
yield file;
}
});
},
});
}
}
Hi, +1 Yes Please, please, please !!!
and also for Angular, (may be also for Vue & react)
You preconize to extends "services" classes for further customizations pattern-3---side-by-side
but these classes must be open for extention (private -> protected).
if not lot of boiler code will be duplicated.
Please create a PR with this enhancement. I'd be happy to review it!
This issue is stale because it has been open for too long without any activity. Due to the moving nature of jhipster generated application, bugs can become invalid. If this issue still applies please comment otherwise it will be closed in 7 days
Overview of the feature request
If JHipster is used as a building block of a real-world application, almost all of those generated classes need to be extended to separate customized code from the generated code. However, such an extended class won't be able to access its parent class attributes unless it changes the attribute modifiers to protected from private in its parent class.
Motivation for or Use Case
If JHipster is meant for real-world application usage, not just for demos or small-scale prototyping, it needs to be built for customization.
For example, a new web tier controller method is needed in addition to those generated ones. Based on the Single Responsibility Principle principle, a controller class with the new method is created by extending the existing controller class instead of creating an independent controller class, because it is for the same responsibility and the same consumer. In this case, the protected access modifier would make this type of customization litter easier.
Related issues or PR