use of org.springframework.data.mapping.PropertyHandler in project spring-cloud-gcp by spring-cloud.
the class MappingSpannerWriteConverter method write.
/**
* Writes an object's properties to the sink.
* @param source the object to write
* @param sink the sink to which to write
* @param includeColumns the properties/columns to write. If null, then all columns
* are written.
*/
public void write(Object source, WriteBuilder sink, Set<String> includeColumns) {
boolean writeAllColumns = includeColumns == null;
SpannerPersistentEntity<?> persistentEntity = this.spannerMappingContext.getPersistentEntity(source.getClass());
PersistentPropertyAccessor accessor = persistentEntity.getPropertyAccessor(source);
persistentEntity.doWithProperties((PropertyHandler<SpannerPersistentProperty>) spannerPersistentProperty -> {
if (!writeAllColumns && !includeColumns.contains(spannerPersistentProperty.getColumnName())) {
return;
}
writeProperty(sink, accessor, spannerPersistentProperty);
});
}
Aggregations