diff --git a/JMapper Framework/src/main/java/com/googlecode/jmapper/operations/AGeneralOperation.java b/JMapper Framework/src/main/java/com/googlecode/jmapper/operations/AGeneralOperation.java index 6bd95bc4..8b8883b8 100644 --- a/JMapper Framework/src/main/java/com/googlecode/jmapper/operations/AGeneralOperation.java +++ b/JMapper Framework/src/main/java/com/googlecode/jmapper/operations/AGeneralOperation.java @@ -56,6 +56,7 @@ private StringBuilder calculateSourceNestedMapping(){ String nestedField = "nestedField"+ ++index; for (NestedMappedField nestedMappedField : this.nestedMappingInfo.getNestedFields()) { + //TODO tenere conto del MappingType! //TODO potrei volere il safeNavigation in alcuni punti e non in tutti // quindi devo essere in grado di lanciare exception quando serve tryCatch(mapping, nestedField, actualField, nestedMappedField); diff --git a/JMapper Framework/src/main/java/com/googlecode/jmapper/operations/recursive/ObjectOperation.java b/JMapper Framework/src/main/java/com/googlecode/jmapper/operations/recursive/ObjectOperation.java index 7ef5e8a4..d7c15ec5 100644 --- a/JMapper Framework/src/main/java/com/googlecode/jmapper/operations/recursive/ObjectOperation.java +++ b/JMapper Framework/src/main/java/com/googlecode/jmapper/operations/recursive/ObjectOperation.java @@ -37,7 +37,7 @@ protected StringBuilder fieldToCreate() { // name of new Object String newObj = "obj"+count++; - return write(getMapper(newObj).mapping(newInstance, ALL_FIELDS, ALL_FIELDS),setDestination(newObj)); + return write(getMapper(newObj).mapping(newInstance, ALL_FIELDS, getMts()),setDestination(newObj)); } /** diff --git a/JMapper Framework/src/test/java/com/googlecode/jmapper/operations/recursive/ObjectOperationTest.java b/JMapper Framework/src/test/java/com/googlecode/jmapper/operations/recursive/ObjectOperationTest.java index 111d0f15..e15ca4a6 100644 --- a/JMapper Framework/src/test/java/com/googlecode/jmapper/operations/recursive/ObjectOperationTest.java +++ b/JMapper Framework/src/test/java/com/googlecode/jmapper/operations/recursive/ObjectOperationTest.java @@ -84,9 +84,11 @@ protected void AllValued() { newLine + " }else{" + newLine + " obj$i = new com.googlecode.jmapper.bean.TargetObject();" + newLine + " }" + - newLine + " obj$i.setField(source.getMappedObject().getField());"+ - newLine + " destination.setTargetObject(obj$i);"+ - newLine + " }"+newLine; + newLine + " if(source.getMappedObject().getField()!=null){"+ + newLine + " obj$i.setField(source.getMappedObject().getField());"+ + newLine + " }"+ + newLine + " destination.setTargetObject(obj$i);"+ + newLine + " }"+newLine; write(newInstance); verify(); @@ -104,8 +106,10 @@ protected void AllValued() { newLine + " }else{" + newLine + " obj$i = new com.googlecode.jmapper.bean.TargetObject();" + newLine + " }" + - newLine + " obj$i.setField(source.getMappedObject().getField());"+ - newLine + " destination.setTargetObject(obj$i);"+ + newLine + " if(source.getMappedObject().getField()!=null){"+ + newLine + " obj$i.setField(source.getMappedObject().getField());"+ + newLine + " }"+ + newLine + " destination.setTargetObject(obj$i);"+ newLine + " }"+ newLine + " }"+newLine; @@ -173,8 +177,11 @@ protected void NullValued() { newLine + " }else{" + newLine + " obj$i = new com.googlecode.jmapper.bean.TargetObject();" + newLine + " }" + - newLine + " obj$i.setField(source.getMappedObject().getField());"+ - newLine + " destination.setTargetObject(obj$i);"+ + +newLine + " if(source.getMappedObject().getField()!=null){"+ +newLine + " obj$i.setField(source.getMappedObject().getField());"+ +newLine + " }"+ +newLine + " destination.setTargetObject(obj$i);"+ newLine + " }"+ newLine + " }"+newLine;