This is the official cli of XRest library
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.
- Java 17 runtime or higher
- the cli jar: xrest-cli.1.0.1.jar
- your target web project should have:
- Spring Boot
- Mapstruct
- JPA
- XRest 1.0.13 or higher
- Download the cli JAR file (xrest-cli.1.0.1.jar)
- 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:
- dto classes for all the CRUD endpoints (input/output dtos)
- 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: