Replies: 2 comments 5 replies
-
|
Looks like Mapping with a Map must be a @filiphr so many guards against my Map having an Integer as key :) private boolean hasStringMapSignature() {
if ( isMapType() ) {
List<Type> typeParameters = getTypeParameters();
if ( typeParameters.size() == 2 && typeParameters.get( 0 ).isString() ) {
return true;
}
}
return false;
}and for example this.It looks like it's really not meant to do what I'm trying to do :) Any other ways to accomplish this? static PresenceCheckAccessor mapContainsKey(String propertyName) {
return suffix( ".containsKey( \"" + propertyName + "\" )" );
} |
Beta Was this translation helpful? Give feedback.
-
|
MapStruct currently only supports mapping from a The idea behind this was that you can map Objects from a map and objects only have strings as properties. If you want to use some other special maps you'll need to use a custom way of mapping it. An alternative would be that we support some kind of syntax that would allow extracting things from a map using the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a
Map<Integer, String>that I would like to map to a 'bean'.For example:
Target bean (generic example):
Mapper:
Usage example:
It seems like this should be straight forward and I'd expect it to work just like a
Map<String, String>which works fine but this gives me:Beta Was this translation helpful? Give feedback.
All reactions