Skip to content

Commit 85e169b

Browse files
alexottadutra
authored andcommitted
Lookup enum value only once (apache#1133)
1 parent 2473c53 commit 85e169b

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

  • driver-mapping/src/main/java/com/datastax/driver/mapping

driver-mapping/src/main/java/com/datastax/driver/mapping/Mapper.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,9 @@ private ListenableFuture<BoundStatement> saveQueryAsync(
257257
T entity, final EnumMap<Option.Type, Option> options) {
258258
final Map<AliasedMappedProperty, Object> columnToValue =
259259
new TreeMap<AliasedMappedProperty, Object>();
260-
final boolean useUnsetForNullValue =
261-
!shouldSaveNullFields(options) && manager.protocolVersionAsInt >= 4;
262-
final boolean includeColumnsWithNullValue =
263-
shouldSaveNullFields(options) || useUnsetForNullValue;
260+
final boolean shouldSaveNullFields = shouldSaveNullFields(options);
261+
final boolean useUnsetForNullValue = !shouldSaveNullFields && manager.protocolVersionAsInt >= 4;
262+
final boolean includeColumnsWithNullValue = shouldSaveNullFields || useUnsetForNullValue;
264263

265264
for (AliasedMappedProperty col : mapper.allColumns) {
266265
Object value = col.mappedProperty.getValue(entity);

0 commit comments

Comments
 (0)