This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository observe. See http://git.codelutin.com/observe.git commit 83899db17e10a5d7d0166890701a528c71606713 Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Nov 8 21:18:22 2015 +0100 Calculer les types des composants d'une référence à partir de l'introspection et non plus les valeurs (si elles sont nulles, on perd le type à la sérialisation) --- .../java/fr/ird/observe/services/dto/ReferenceDto.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/observe-services-model/src/main/java/fr/ird/observe/services/dto/ReferenceDto.java b/observe-services-model/src/main/java/fr/ird/observe/services/dto/ReferenceDto.java index 5160dbd..3989214 100644 --- a/observe-services-model/src/main/java/fr/ird/observe/services/dto/ReferenceDto.java +++ b/observe-services-model/src/main/java/fr/ird/observe/services/dto/ReferenceDto.java @@ -25,6 +25,9 @@ package fr.ird.observe.services.dto; import com.google.common.base.MoreObjects; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; +import fr.ird.observe.services.dto.referential.I18nReferentialDto; +import org.nuiton.util.beans.Binder; +import org.nuiton.util.beans.BinderFactory; import java.io.Serializable; import java.util.Arrays; @@ -59,6 +62,18 @@ public class ReferenceDto<D extends IdDto> extends AbstractReferenceDto { this.labelPropertyNames = Lists.newArrayList(labelPropertyNames); this.labelPropertyValues = new Serializable[this.labelPropertyNames.size()]; this.labelPropertyTypes = new Class[this.labelPropertyNames.size()]; + Binder<D, D> ddBinder = BinderFactory.newBinder(type); + int index=0; + for (String labelPropertyName : labelPropertyNames) { + Class<?> sourcePropertyType; + if (I18nReferentialDto.PROPERTY_LABEL.equals(labelPropertyName)) { + sourcePropertyType = String.class; + } else { + sourcePropertyType = ddBinder.getSourcePropertyType(labelPropertyName); + } + this.labelPropertyTypes[index++] = sourcePropertyType; + } + } public Serializable getPropertyValue(String propertyName) { @@ -74,7 +89,6 @@ public class ReferenceDto<D extends IdDto> extends AbstractReferenceDto { Preconditions.checkNotNull(propertyName, "propertyName parameter can't be null"); int propertyIndex = getPropertyIndex(propertyName); labelPropertyValues[propertyIndex] = propertyValue; - labelPropertyTypes[propertyIndex] = propertyValue.getClass(); } public void addPropertyValue(String propertyName, Serializable propertyValue) { @@ -94,8 +108,8 @@ public class ReferenceDto<D extends IdDto> extends AbstractReferenceDto { } else { labelPropertyValues[propertyIndex] = propertyValue; - labelPropertyTypes[propertyIndex] = propertyValue.getClass(); } + } protected int getPropertyIndex(String propertyName) { -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.