mapstruct / mapstruct/mapstruct
mapstruct native support protobuf
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Java
- Sterne
- 7.7k
- Forks
- 1.1k
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Use case
The reasons are as follows:
-
gRPC use protobuf ,Jakarta EE 10 choise gRPC as Jakarta RPC , . Net Core same choise gRPC.
-
It is a good idea in the near future that protobuf will be selected as the data exchange foundation of heterogeneous platforms for service mash of microservice architecture.
-
MapStruct is not friendly to protobuf. For a long time, it will inevitably generate new components instead of building on the MapStruct foundation. It may introduce technologies similar to ByteBuf to improve the copy efficiency.
-
No configuration is better than complex configuration. Most people choose MapStruct not to learn complex configuration, but to improve efficiency. In complex scenarios, customers write code instead of configuring MapStruct, which seems to go further and further. What is the original intention of the project? Is the goal of the project to solve complex situations through configuration?
I look forward to your reply!
Generated Code
Bean Map copy to Protobuf Map putAll Error : UnsupportedOperationException.
correct:
basicTestMessageMap.putAllTestStrMap(map);
replace
basicTestMessageMap.getTestStrMap().putAll( map );
@Override
public BasicTestMessageMap toMap(BasicTestBeanMap beanMap) {
if ( beanMap == null ) {
return null;
}
BasicTestMessageMap.Builder basicTestMessageMap = BasicTestMessageMap.newBuilder();
if ( basicTestMessageMap.getTestStrMap() != null ) {
Map<String, String> map = beanMap.getTestStrMap();
if ( map != null ) {
basicTestMessageMap.getTestStrMap().putAll( map );
}
}
return basicTestMessageMap.build();
}
Possible workarounds
No response
MapStruct Version
1.5.3.Final
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, das im generierten BasicTestMessageMap-Mapper gezeigte protobuf map mapping zu reproduzieren und die UnsupportedOperationException aus dem getter-basierten putAll-Aufruf zu bestätigen. Vergleiche den generierten Code mit der angeforderten Builder-Map-Operation; abgeschlossen ist dies, wenn protobuf map mappings ohne diese Ausnahme funktionieren und das beabsichtigte generierte Verhalten durch einen Regressionstest abgedeckt ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- backend-api-design
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 30/100