Questions tagged [object-object-mapping]
129 questions
6
votes
3 answers
Can MapStruct be told to not perform automatic mappings?
I have a rather big bean (~ 100 properties) that is mapped into several smaller objects. It may occur that the smaller target objects have properties with the same name as in my source bean, but not with the same semantic meaning.
I would like…

pesche
- 3,054
- 4
- 34
- 35
5
votes
2 answers
Mapstruct Mapping : Return null object if all source parameters properties are null
I want the generated mapstruct mapping method to return null if all the properties referenced in @Mapping/source are null.
For exemple, I have the following mapping :
@Mappings({
@Mapping(target = "id", source = "tagRecord.tagId"),
…

Max
- 105
- 1
- 1
- 4
5
votes
2 answers
ExpressMapper / EntityFramework - No parameterless constructor defined for this object
I am trying to use ExpressMapper to map data entities to models.
If I map entity to a model directly (both of them having same properties) then it is working fine.
But if I map linked entities to model then I am getting an error
There was an error:…

Rocky
- 139
- 12
5
votes
2 answers
Automapper - Bestpractice of mapping a many-to-many association into a flat object
I have two entities: Employee and Team.
What I want is an EmployeeForm that has the Name of the Team.
How can I achieve this using AutoMapper?
My current "solution" is the following:
Mapper.CreateMap()
…

Rookian
- 19,841
- 28
- 110
- 180
5
votes
3 answers
Convert a part of Json to HashMap using Jackson ObjectMapper
I am trying to unmarshall a json file in a way such that few properties of Json are mapped into a HashMap that is present in my model class.Rest of the properties are mapped to the respective fields of the class.Please find the Json below:
{
…

Puneetr90
- 199
- 1
- 6
- 18
5
votes
1 answer
Flatten a nested object to map its properties to the target object
I'm trying to use AutoMapper to map classes like this:
class FooDTO
{
public int X { get; set; }
public EmbeddedDTO Embedded { get; set; }
public class EmbeddedDTO
{
public BarDTO Y { get; set; }
public BazDTO Z {…

Thomas Levesque
- 286,951
- 70
- 623
- 758
5
votes
2 answers
Ajax pass a "Map" object to Spring MVC Controller
It seems like Spring MVC doesn't know how to map a javascript "map" to a Java map object
In the web UI, say, foo.jsp,