Giter VIP home page Giter VIP logo

dozer-with-kotlin's Introduction

Dozer with Kotlin

Build Status License

This is a simple demo project to show the usage of Dozer in a Spring Boot Kotlin project. Dozer can be used map and copy objects recursively. This can provide much benefit in a layered architecture. For example when a domain object must be mapped to DTOs or database entities.

Run it

./gradlew bootRun

Then make some calls against the REST APIs:

POST to http://localhost:8080/users
GET  to http://localhost:8080/users
GET  to http://localhost:8080/users/<userId>

Examples

Note that the payload of the following examples is slightly different in each case. Every request represents another view on the user. All objects contain a different set of fields. This is a typical use-case where Dozer is very handy.

Create a new user:

POST to localhost:8080/users:

{
    "firstName": "Jon",
    "lastName": "Doe",
    "nickName": "jonny3000",
    "password": "123456",
    "addresses": [
        { "street": "Teststreet 42", "city": "Testcity" }
    ]
}

Request a list of all users:

GET to localhost:8080/users

[
    {
        "nickName": "jonny3000"
    }
]

Request a single user by its internal unique ID:

GET to localhost:8080/users/<see log for user ID>

{
    "firstName": "Jon",
    "lastName": "Doe",
    "nickName": "jonny3000",
    "addresses": [
        { "street": "Teststreet 42", "city": "Testcity" }
    ]
}

Resources

dozer-with-kotlin's People

Contributors

tuhrig avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

tuhrig

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.