private void writeSimpleInternal(Object value, Bson bson, MongoPersistentProperty property) { DocumentAccessor accessor = new DocumentAccessor(bson); accessor.put(property, getPotentiallyConvertedSimpleWrite(value)); }
protected void writeInternal(@Nullable Object obj, Bson bson, @Nullable MongoPersistentEntity<?> entity) { if (obj == null) { return; } if (null == entity) { throw new MappingException("No mapping metadata found for entity of type " + obj.getClass().getName()); } PersistentPropertyAccessor<?> accessor = entity.getPropertyAccessor(obj); DocumentAccessor dbObjectAccessor = new DocumentAccessor(bson); MongoPersistentProperty idProperty = entity.getIdProperty(); if (idProperty != null && !dbObjectAccessor.hasValue(idProperty)) { Object value = idMapper.convertId(accessor.getProperty(idProperty), idProperty.getFieldType()); if (value != null) { dbObjectAccessor.put(idProperty, value); } } writeProperties(bson, entity, accessor, dbObjectAccessor, idProperty); }
private void writeSimpleInternal(Object value, Bson bson, MongoPersistentProperty property) { DocumentAccessor accessor = new DocumentAccessor(bson); accessor.put(property, getPotentiallyConvertedSimpleWrite(value)); }
protected void writeInternal(@Nullable Object obj, Bson bson, @Nullable MongoPersistentEntity<?> entity) { if (obj == null) { return; } if (null == entity) { throw new MappingException("No mapping metadata found for entity of type " + obj.getClass().getName()); } PersistentPropertyAccessor<?> accessor = entity.getPropertyAccessor(obj); DocumentAccessor dbObjectAccessor = new DocumentAccessor(bson); MongoPersistentProperty idProperty = entity.getIdProperty(); if (idProperty != null && !dbObjectAccessor.hasValue(idProperty)) { Object value = idMapper.convertId(accessor.getProperty(idProperty)); if (value != null) { dbObjectAccessor.put(idProperty, value); } } writeProperties(bson, entity, accessor, dbObjectAccessor, idProperty); }