com.backendless.transaction.OpResultIdGenerator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of backendless Show documentation
Show all versions of backendless Show documentation
Android SDK used by developers to provide Backendless API in apps.
package com.backendless.transaction;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
class OpResultIdGenerator
{
private List opResultIdStrings;
private final Map opResultIdMaps = new HashMap<>();
OpResultIdGenerator( List opResultIdStrings )
{
this.opResultIdStrings = opResultIdStrings;
}
String generateOpResultId( OperationType operationType, String tableName )
{
String opResultIdGenerated;
final String key = operationType.getOperationName() + tableName;
if( opResultIdMaps.containsKey( key ) )
{
int count = opResultIdMaps.get( key );
opResultIdMaps.put( key, ++count );
opResultIdGenerated = key + count;
}
else
{
opResultIdMaps.put( key, 1 );
opResultIdGenerated = key + 1;
}
opResultIdStrings.add( opResultIdGenerated );
return opResultIdGenerated;
}
}