Skip to content

sattinos/xrest.cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xrest.cli

This is the official cli of XRest library

Motivation

After understanding how to use the library, you want to scaffold the list of classes needed for an entity CRUD functionality. This cli is mainly concerned about scaffolding.

Prerequisites

  1. Java 17 runtime or higher
  2. the cli jar: xrest-cli.1.0.1.jar
  3. your target web project should have:

How to use

  1. Download the cli JAR file (xrest-cli.1.0.1.jar)
  2. Trigger the cli code generation command by writing this on a terminal:
java -jar xrest-cli.1.0.1.jar -e YOUR_ENTITY_NAME -p PATH_OF_YOUR_PROJECT

Once triggered, the cli scans your project and searches for an entity with the name that your submitted.

If found, the following classes will be generated:

  1. dto classes for all the CRUD endpoints (input/output dtos)
  2. repository/service/mapper/controller for the chosen entity.

once scaffolded, you need to add your custom logic and follow the XRest steps as usual.

example:

  • you have a web project at the path: d:/programs/reporter
  • this project contains an entity named "Contract"
  • by invoking the command:
java -jar xrest-cli.1.0.1.jar -e Contract -p d:/programs/reporter

The scaffold process will start and a new set of classes and folders will be created inside your target project:

Let's assume:

srcPath = d:/programs/reporter/src/main/java/com/malsati/reporter

     dto
        contract
           {srcPath}/dto/contract/CreateOneContractInputDto.java
           {srcPath}/dto/contract/CreateOneContractOutputDto.java
           {srcPath}/dto/contract/UpdateOneContractInputDto.java
           {srcPath}/dto/contract/DeleteOneContractOutputDto.java
           {srcPath}/dto/contract/GetOneContractOutputDto.java
     infrastructure
        {srcPath}/infrastructure/ContractRepository.java
     mapper
        {srcPath}/mapper/ContractMapper.java           
     services
        {srcPath}/services/ContractService.java
     controllers
        {srcPath}/controllers/ContractController.java

This is a sample cli output:

About

This is the official cli of XRest library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages