record-builder VS MapStruct

Compare record-builder vs MapStruct and see what are their differences.

CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
record-builder MapStruct
35 27
762 7,167
- 0.8%
6.3 8.6
10 days ago 9 days ago
Java Java
Apache License 2.0 Apache License 2.0
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

record-builder

Posts with mentions or reviews of record-builder. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-01-24.

MapStruct

Posts with mentions or reviews of MapStruct. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-07-29.
  • What can happen if you skip the DTOs
    2 projects | dev.to | 29 Jul 2024
    You do not have to write the boilerplate code mapping the fields between your DTO and the other layers of your application. MapStruct can do it for you.
  • A single ChatGPT mistake cost us $10k
    8 projects | news.ycombinator.com | 9 Jun 2024
    > You don't need to make DTOs when you don't have to, using AutoMapper is considered a bad practice and is heavily discouraged (if you do have to use a tool like that, there are alternatives like Mapperly which are zero-cost to use and will give you built-time information on what doesn't map without having to run the application).

    The thing is, that you'll probably have entities mapped against the database schema with data that must only conditionally be shown to the users. For example, when an admin user requests OrderDetails then you'll most likely want to show all of the fields, but when an external user makes that request, you'll only want to show some of the fields (and not leak that those fields even exist).

    DTOs have always felt like the right way to do that, however this also means that for every distinct type of user you might have more than one object per DB table. Furthermore, if you generate the EF entity mappings from the schema (say, if you handle migrations with a separate tool that has SQL scripts in it), then you won't make separate entities for the same table either. Ergo, it must be handled downstream somewhere.

    Plus, sometimes you can't return the EF entities for serialization into JSON anyways, since you'd need to introduce some additional parsing logic, to get them into a shape that the front end wants (e.g. if you have a status field or something, the current value of which is calculated based on 5-10 database fields or other stuff).

    Not to say that some of those can't be worked around, but I can't easily handwave those use cases away either. In Java, MapStruct works and does so pretty well: https://mapstruct.org/ I'd rather do something like that, than ask ChatGPT to transpose stuff from DDL or whatever, or waste time manually doing that.

  • Which tricks do you use to write less code?
    2 projects | news.ycombinator.com | 10 May 2024
    I found some "tricks" to write less code, hence less code to maintain if there are any changes. Also less code with bugs just by changing the inputs.

    For example, OpenAPI spec file + OpenAPI generator (https://github.com/OpenAPITools/openapi-generator). Any changes in the OpenAPI spec are reflected in the final code with a build step.

    Another example: MapStruct (https://mapstruct.org/) to avoid passing data from Entity classes to DTO and back. Saves looots of boilerplate code.

    Which are your tricks?

  • Is .NET just miles ahead or am I delusional?
    4 projects | news.ycombinator.com | 13 Apr 2024
  • Object mapping libraries
    1 project | /r/Python | 18 Sep 2023
    In Java (woof..) we have MapStruct (https://mapstruct.org/). Anything like that in Python? I think maybe the Sqlalchemy mapping in Litestar2 is the closest I've seen.
  • Feedback on a new annotation processor api
    9 projects | /r/java | 20 May 2023
    Done right i can look something like mapstruct for example. But like any other feature you need to get a feeling for when it's a good idea to use it.
  • Mapping in Domain Driven Design sucks
    1 project | /r/javahelp | 6 Feb 2023
    We are using mapstruct but it sucks when you have protobuf :/
  • must known frameworks/libs/tech, every senior java developer must know(?)
    6 projects | /r/java | 9 Dec 2022
    You all beat me to MapStruct and Testcontainers. Honorable mention to RxJava, which I use in Desktop apps.
  • Correct way of exception handling, an optional?
    1 project | /r/javahelp | 30 Nov 2022
    For the mapping, I'm using Mapstruct, I got the instance example from their examples they use INSTANCE as constant.
  • Ask HN: What are your “scratch own itch” projects?
    34 projects | news.ycombinator.com | 13 Nov 2022

What are some alternatives?

When comparing record-builder and MapStruct you can also consider the following projects:

Lombok - Very spicy additions to the Java programming language.

ModelMapper - Intelligent object mapping

awesome-annotation-processing - A curated list of resources related to the Java annotation processing API (JSR 269)

JMapper Framework - Elegance, high performance and robustness all in one java bean mapper

core - An advanced and highly optimized Java library to build frameworks: it's useful for scanning class paths, generating classes at runtime, facilitating the use of reflection, scanning the filesystem, executing stringified source code and much more...

Orika - Simpler, better and faster Java bean mapping framework

Immutables - Annotation processor to create immutable objects and builders. Feels like Guava's immutable collections but for regular value objects. JSON, Jackson, Gson, JAX-RS integrations included

Dozer - Dozer is a Java Bean to Java Bean mapper that recursively copies data from one object to another.

Jackson JSON Processor - Main Portal page for the Jackson project

Selma - Selma Java bean mapping that compiles

javageci - Java Code Generation Framework

CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured

Did you konow that Java is
the 8th most popular programming language
based on number of metions?