in mapper-processor/src/main/java/com/datastax/oss/driver/internal/mapper/processor/dao/NullSavingStrategyValidation.java [56:98]
public boolean hasDoNotSetOnAnyLevel(
List<ExecutableElement> methodElements, @Nullable DefaultNullSavingStrategy annotation) {
boolean anyMethodHasOrDefaultsToDoNotSet =
methodElements.stream()
.anyMatch(
v ->
updateHasDoNotSet(v, false)
|| insertHasDoNotSet(v, false)
|| setEntityHasDoNotSet(v, false)
|| queryHasDoNotSet(v, false));
boolean anyMethodHasDoNotSetExplicitly =
methodElements.stream()
.anyMatch(
v ->
updateHasDoNotSet(v, true)
|| insertHasDoNotSet(v, true)
|| setEntityHasDoNotSet(v, true)
|| queryHasDoNotSet(v, true));
boolean allMethodsHaveSetToNull =
methodElements.stream()
.filter(this::isOperationWithNullSavingStrategy)
.allMatch(
v ->
updateHasSetToNullExplicitly(v)
|| insertHasSetToNullExplicitly(v)
|| setEntitySetToNullExplicitly(v)
|| queryHasSetToNullExplicitly(v));
// if DAO level SET_TO_NULL check all underlying annotations for explicit set to DO_NOT_SET
// (they may override it)
if (daoHasSetToNull(annotation) && anyMethodHasDoNotSetExplicitly) {
return true;
// if DAO level DO_NOT_SET check if all underlying override it explicitly to SET_TO_NULL
} else if (daoHasDoNotSet(annotation) && !allMethodsHaveSetToNull) {
return true;
// if DAO level annotation do not present, check method level strategy
// (including the default one)
} else {
return daoIsNotAnnotated(annotation) && anyMethodHasOrDefaultsToDoNotSet;
}
}