Environment:
class SourceRef{
List<String> identities;
...
}
class Dest{
String id;
List<DestReference> references;
...
}
class DestReference{
String identity;
....
}
I`d like to map SourceRef class to Dest class and class map config will be like
this:
factory.classMap(SourceRef.class, Dest.class)
.mapNulls(false)
.fieldAToB("identities{}", "references{identity}")
.register();
if SourceRef.identities contains equals strings then Dest.references contains
only one element
for example:
1)
SourceRef.identities = a,a,a
Dest.references = a
2) Like (1) but some differ
SourceRef.identities = a,a,b,a
Dest.references = a,b,a
I think it because mapper class contains next code:
Mapper class
...
public void mapAtoB(java.lang.Object a, java.lang.Object b,
ma.glasnost.orika.MappingContext mappingContext) {
...
while (identities_$_iter.hasNext()) {
java.lang.String identities_source0Element = "" + identities_$_iter.next();
if (references_destination0Element == null
|| !(((((java.lang.String) identities_source0Element) != null && ((java.lang.String) identities_source0Element)
.equals(((java.lang.String) references_destination0Element
.getIdentity())))))) {
seals_destination0Element = ((DestReference) ((ma.glasnost.orika.BoundMapperFacade) usedMapperFacades[5]).newObject(identities_source0Element, mappingContext));
seals_destination0ElementShouldBeAddedToCollector = true;
}
if (!(((java.lang.String) identities_source0Element) == null)) {
references_destination0Element.setIdentity(((java.lang.String) identities_source0Element));
}
if (references_destination0ElementShouldBeAddedToCollector) {
new_destinationReferences0.add(((References) references_destination0Element));
references_destination0ElementShouldBeAddedToCollector = false;
}
}
...
First If condition contains comparation New (current loop) source identiti and
OLD (prev loop) dest Identity in the loop
Original issue reported on code.google.com by mvfedorov on 20 Aug 2013 at 11:42
Original issue reported on code.google.com by
mvfedorov
on 20 Aug 2013 at 11:42