fix the same issue for writes as well

This commit is contained in:
derklaro 2022-08-10 14:17:12 +02:00 committed by Dan Mulloy
parent 9ca3d8fee8
commit bd2ae801ad
1 changed files with 3 additions and 7 deletions

View File

@ -327,14 +327,10 @@ public class StructureModifier<T> {
return this;
}
// just write the value if the specific given one is null or no conversion is needed
if (value == null || !this.needConversion()) {
accessor.set(this.target, value);
return this;
}
// convert and write
accessor.set(this.target, this.converter.getGeneric(value));
Object fieldValue = this.needConversion() ? this.converter.getGeneric(value) : value;
accessor.set(this.target, fieldValue);
return this;
}