use of software.amazon.awssdk.utils.Either in project aws-sdk-java-v2 by aws.
the class UpdateItemOperation method generateConditionExpressionIfExist.
/**
* Retrieves the ConditionExpression from extensions if existing, and retrieves the ConditionExpression from the request
* if existing. If both exist, they are merged.
*/
private Expression generateConditionExpressionIfExist(WriteModification transformation, Either<UpdateItemEnhancedRequest<T>, TransactUpdateItemEnhancedRequest<T>> request) {
Expression conditionExpression = null;
if (transformation != null && transformation.additionalConditionalExpression() != null) {
conditionExpression = transformation.additionalConditionalExpression();
}
Expression operationConditionExpression = request.map(r -> Optional.ofNullable(r.conditionExpression()), r -> Optional.ofNullable(r.conditionExpression())).orElse(null);
if (operationConditionExpression != null) {
conditionExpression = operationConditionExpression.and(conditionExpression);
}
return conditionExpression;
}
Aggregations