public void deleteIfExists ( T object ) throws ConditionalCheckFailedException { final DynamoDBDeleteExpression deleteExpression = new DynamoDBDeleteExpression ( ) ; for ( final DynamoDBMapperFieldModel < T , Object > key : model . keys ( ) ) { deleteExpression . withExpectedEntry ( key . name ( ) , new ExpectedAttributeValue ( ) . withExists ( true ) . withValue ( key . convert ( key . get ( object ) ) ) ) ; } mapper . delete ( object , deleteExpression ) ; }
Deletes the given object from its DynamoDB table with the condition that the hash and if applicable the range key already exist .