Class ProjectConverterStorage
java.lang.Object
com.e1c.langtool.internal.converter.db.ProjectConverterStorage
Represents a storage mechanism for managing converted data associated with language projects.
The ProjectConverterStorage class provides methods for managing converted values, target keys, and
resource indexes associated with a specific IProject.
Usage example:
// Create an instance of ProjectConverterStorage for a specific IProject
IProject project = ...; // Specify the language project
ProjectConverterStorage converterStorage = new ProjectConverterStorage(project);
// Check if the storage is empty
boolean isEmpty = converterStorage.isEmpty();
// Check if converted values exist for a specific IPath
IPath path = ...; // Specify the resource path
boolean valuesExist = converterStorage.valuesExists(path);
// Get converted values for a specific IPath
ConvertedValues values = converterStorage.getValues(path);
// Put converted values for a specific IPath
ConvertedValues newValues = ...; // Specify the new converted values
converterStorage.putValues(path, newValues);
// Remove converted values for a specific IPath
converterStorage.removeValues(path);
// Get the target key for a specific IPath
String targetKey = converterStorage.getTargetKey(path);
// Put the target key for a specific IPath
String newTargetKey = ...; // Specify the new target key
converterStorage.putTargetKey(path, newTargetKey);
// Remove the target key for a specific IPath
converterStorage.removeTargetKey(path);
Note: The ProjectConverterStorage assumes that all provided IPaths, converted values, and target keys are
non-null.
-
Constructor Summary
ConstructorsConstructorDescriptionProjectConverterStorage(org.eclipse.core.resources.IProject project) Creates a new instance ofProjectConverterStoragefor the specifiedIProject. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the store.collectValues(org.eclipse.core.runtime.IPath path, ConvertedValues values) Collects the converted values for a specific resource path.booleandelete()Deletes the storage and associated files for the language project.getTargetKey(org.eclipse.core.runtime.IPath path) Gets the target key for a specific resource path.getValues(org.eclipse.core.runtime.IPath path) Gets the converted values for a specific resource path.booleanisEmpty()Checks whether the storage is empty.voidopen()Opens the storage.putTargetKey(org.eclipse.core.runtime.IPath path, String targetKey) Puts the target key for a specific resource path.putValues(org.eclipse.core.runtime.IPath path) Puts the converted values for a specific resource path.removeTargetKey(org.eclipse.core.runtime.IPath path) Removes the target key for a specific resource path.removeValues(org.eclipse.core.runtime.IPath path) Removes the converted values for a specific resource path.booleanvaluesExists(org.eclipse.core.runtime.IPath path) Checks if converted values exist for a specific resource path.
-
Constructor Details
-
ProjectConverterStorage
public ProjectConverterStorage(org.eclipse.core.resources.IProject project) Creates a new instance ofProjectConverterStoragefor the specifiedIProject.- Parameters:
project- the language project to associate with the storage, cannot benull.
-
-
Method Details
-
isEmpty
public boolean isEmpty()Checks whether the storage is empty.- Returns:
trueif the storage is empty,falseotherwise.
-
valuesExists
public boolean valuesExists(org.eclipse.core.runtime.IPath path) Checks if converted values exist for a specific resource path.- Parameters:
path- the resource path to check, cannot benull.- Returns:
trueif converted values exist,falseotherwise.
-
getValues
Gets the converted values for a specific resource path.- Parameters:
path- the resource path to retrieve converted values for, cannot benull.- Returns:
- the converted values for the specified path, or an empty set if none exist.
-
putValues
Puts the converted values for a specific resource path.- Parameters:
path- the resource path to store converted values for, cannot benull.- Returns:
- the previous converted values for the specified path, or an empty set if none existed.
-
collectValues
Collects the converted values for a specific resource path.- Parameters:
path- the resource path to store converted values for, cannot benull.values- the converted values to store, cannot benull.- Returns:
- the previous converted values for the specified path, or an empty set if none existed.
-
removeValues
Removes the converted values for a specific resource path.- Parameters:
path- the resource path to remove converted values for, cannot benull.- Returns:
- the removed converted values for the specified path, or an empty set if none existed.
-
getTargetKey
Gets the target key for a specific resource path.- Parameters:
path- the resource path to retrieve the target key for, cannot benull.- Returns:
- the target key for the specified path, or an empty string if none exists.
-
putTargetKey
Puts the target key for a specific resource path.- Parameters:
path- the resource path to store the target key for, cannot benull.targetKey- the target key to store, cannot benull.- Returns:
- the previous target key for the specified path, or an empty string if none existed.
-
removeTargetKey
Removes the target key for a specific resource path.- Parameters:
path- the resource path to remove the target key for, cannot benull.- Returns:
- the removed target key for the specified path, or an empty string if none existed.
-
open
public void open()Opens the storage. -
close
public void close()Closes the store. -
delete
public boolean delete()Deletes the storage and associated files for the language project.The
deletemethod removes the storage, resource index, and associated MapDB files for the language project, ensuring a clean state. It returnstrueto indicate a successful deletion.Note: The
deletemethod assumes that the storage and associated files exist.- Returns:
trueif the deletion is successful,falseotherwise.
-