final Object[] stateBeforePrepare = new Object[writeCommands.length];
for (int i=0; i<writeCommands.length; i++) {
final WriteCommand writeCommand = writeCommands[i];
if (writeCommand instanceof PutKeyValueCommand) {
InternalCacheEntry internalCacheEntry = dataContainer.get(((PutKeyValueCommand) writeCommand).getKey());
stateBeforePrepare[i] = internalCacheEntry != null ? internalCacheEntry.getValue() : null;
}
else if (writeCommand instanceof PutMapCommand) {
//think about this: ISPN-2478
}
else if (writeCommand instanceof RemoveCommand) {
InternalCacheEntry internalCacheEntry = dataContainer.get(((RemoveCommand) writeCommand).getKey());
stateBeforePrepare[i] = internalCacheEntry != null ? internalCacheEntry.getValue() : null;
}
else if (writeCommand instanceof ReplaceCommand) {
InternalCacheEntry internalCacheEntry = dataContainer.get(((ReplaceCommand) writeCommand).getKey());
stateBeforePrepare[i] = internalCacheEntry != null ? internalCacheEntry.getValue() : null;
}
}
final Object toReturn = super.visitPrepareCommand(ctx, command);