ModelMapper Provider ignored on first level properties of a mapping -
i have used provider in modelmapper transformation i've stumbled upon weird situation. i've noticed provider being considered objects beyond "first level" of transformation, eg.: have 2 hierarchies: 1st) tipoconsultarprocessoresposta, tipoprocessojudicial , tipodocumento 2nd) consultarprocessoresposta, processojudicial , documento tipoconsultarprocessoresposta has tipoprocessojudicial in turn has list of tipodocumento, 2nd hierarchy ressembles first. converting first hierarchy second , provider working fine tipodocumento documento conversion being ignored conversion of tipoprocessojudicial processojudicial.
here relevant part of code:
modelmapper = new modelmapper(); modelmapper.getconfiguration().setmatchingstrategy(strict); modelmapper.addmappings(new documentopropertymap()).setprovider(documentoprovider); modelmapper.addmappings(new processojudicialpropertymap()).setprovider(processojudicialprovider); consultarprocessoresposta resposta = modelmapper.map(tipoconsultarprocessoresposta, consultarprocessoresposta.class);
documentopropertymap extends propertymap<tipodocumento, documento> , processojudicialpropertymap extends propertymap<tipoprocessojudicial, processojudicial>.
the thing documentoprovider being called processojudicialprovider isn't being called. modelmapper tries invoke global provider fails , resorts instantiating through constructor.
Comments
Post a Comment