Class TargetKeyStorage
java.lang.Object
com.e1c.langtool.internal.converter.db.ConverterStorage
com.e1c.langtool.internal.converter.db.TargetKeyStorage
A specialized
ConverterStorage for managing target keys in the conversion process.
The TargetKeyStorage class extends ConverterStorage and provides methods
for accessing and managing target keys associated with unique IDs.
Usage example:
// Create an instance of TargetKeyStorage with a specified DB file
File dbFile = ...; // Specify the DB file
TargetKeyStorage targetKeyStorage = new TargetKeyStorage(dbFile);
// Get the target key associated with a specific ID
long id = ...; // Specify the ID
String targetKey = targetKeyStorage.getTargetKey(id);
// Put or update a target key for a specific ID
String newTargetKey = ...; // Specify the new target key
String previousTargetKey = targetKeyStorage.putTargetKey(id, newTargetKey);
// Remove a target key associated with a specific ID
String removedTargetKey = targetKeyStorage.removeTargetKey(id);
Note: All IDs, target keys, and DB file used in this class are assumed to be non-null.
-
Constructor Summary
ConstructorsConstructorDescriptionTargetKeyStorage(File dbFile) Creates a new instance ofTargetKeyStoragewith the specified DB file. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafterOpenDb(org.mapdb.DB db) After open db.protected voidPerforms tasks before closing the converter storage.getTargetKey(long id) Retrieves the target key associated with the specified ID.putTargetKey(long id, String data) Puts or updates a target key for the specified ID.removeTargetKey(long id) Removes the target key associated with the specified ID.Methods inherited from class com.e1c.langtool.internal.converter.db.ConverterStorage
checkOrOpen, close, delete, getValues, open, putValues, removeValues
-
Constructor Details
-
TargetKeyStorage
Creates a new instance ofTargetKeyStoragewith the specified DB file.- Parameters:
dbFile- the DB file, cannot benull.- Throws:
IllegalArgumentException- if the provided file isnull.
-
-
Method Details
-
getTargetKey
Retrieves the target key associated with the specified ID.- Parameters:
id- the unique ID.- Returns:
- the target key associated with the ID, or
nullif the ID is not found or invalid.
-
putTargetKey
Puts or updates a target key for the specified ID.- Parameters:
id- the unique ID.data- the target key to put or update, cannot benull.- Returns:
- the previous target key associated with the ID, or
nullif there was none.
-
removeTargetKey
Removes the target key associated with the specified ID.- Parameters:
id- the unique ID.- Returns:
- the removed target key, or
nullif the ID is not found or invalid.
-
afterOpenDb
protected void afterOpenDb(org.mapdb.DB db) Description copied from class:ConverterStorageAfter open db.- Overrides:
afterOpenDbin classConverterStorage- Parameters:
db- the db
-
beforeClose
protected void beforeClose()Description copied from class:ConverterStoragePerforms tasks before closing the converter storage.- Overrides:
beforeClosein classConverterStorage
-