Skip to content
This repository has been archived by the owner on Nov 28, 2024. It is now read-only.

Commit

Permalink
adds className,instanceName,classNamePlural,instanceNamePlural to ent…
Browse files Browse the repository at this point in the history
…ity object
  • Loading branch information
ivangsa committed Jun 13, 2022
1 parent 072908d commit dd067ea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/main/jdl-core/cli/parse-jdl.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,3 @@ function checkForErrors(jdlObject, configuration, logger = console) {
}
validator.checkForErrors();
}

// eslint-disable-next-line import/order
// const jdlString = require('fs').readFileSync(process.argv[2], 'utf8');

// parseJDL(jdlString);
5 changes: 5 additions & 0 deletions src/main/jdl-core/jdl/models/jdl-entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

const merge = require('../utils/object-utils').merge;
const { getTableNameFromEntityName } = require('../jhipster/entity-table-name-creator');
const { upperFirst, lowerFirst, pluralize } = require('../utils/string-utils');

module.exports = class JDLEntity {
constructor(args) {
Expand All @@ -28,6 +29,10 @@ module.exports = class JDLEntity {
}
this.options = {};
this.name = merged.name;
this.className = upperFirst(this.name);
this.instanceName = lowerFirst(this.name);
this.classNamePlural = pluralize(this.className);
this.instanceNamePlural = pluralize(this.instanceName);
this.tableName = merged.tableName || merged.name;
this.fields = merged.fields;
this.comment = merged.comment;
Expand Down
2 changes: 2 additions & 0 deletions src/main/jdl-core/jdl/utils/string-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const pluralize = require('pluralize');

module.exports = {
camelCase,
upperFirst,
lowerFirst,
pluralize,
};

function camelCase(string) {
Expand Down

0 comments on commit dd067ea

Please sign in to comment.