@specs-feup/lara
Version:
A js port of the popular framework for building source-to-source compilers
82 lines • 2.8 kB
TypeScript
import { JavaClasses } from "./JavaTypes.js";
/**
* Interface with Java class DataStore, used for storing arbitrary information.
*/
export default class DataStore {
javaDataStoreInstance: JavaClasses.DataStore;
definition: any;
checkKeys: boolean;
allowedKeys: any;
keyAliases: Record<string, string>;
constructor(dataStore?: JavaClasses.DataStore | string | DataStore, definition?: any);
/**
* @returns the value corresponding to the given key, or undefined if no value or null value is found
*/
get(key: string): any;
/**
* Store the given value with the given key.
*/
put(key: string, value: any): void;
disableKeyChecking(): void;
/**
* @returns java.lang.Class representing the type of the value of the given key
*/
getType(key: string): any;
getKeys(): any;
getData(): JavaClasses.DataStore;
addAlias(key: string, alias: string): void;
/**
* Wraps a Java DataStore around a Lara DataStore.
*/
protected dataStoreWrapper(javaDataStore: JavaClasses.DataStore): DataStore;
/**
* @returns the Java class of DataStore
*/
private get DataStoreClass();
/**
* @returns the Java class with utility methods for DataStore
*/
private get UtilityClass();
/**
* Check if there is an alias for the key.
* If no alias, return original key; otherwise, return correct key.
*
* @param key -
* @param functionName -
* @returns The key to be used
*/
private processKey;
private checkKey;
save(fileOrBaseFolder: any, optionalFile?: any): void;
load(fileOrBaseFolder: any, optionalFile?: any): DataStore;
copy(): DataStore;
/**
* Checks if the given key has an associated value in the DataStore.
*
* @param key - The name of the key to check
* @returns true if the data store has a value for the given key, false otherwise
*/
hasValue(key: string): boolean;
/**
*
* @returns The folder of the configuration file, if one was used, or undefined otherwise.
*
*/
getConfigurationFolder(): JavaClasses.File | undefined;
/**
*
* @returns The configuration file, if one was used, or undefined otherwise.
*
*/
getConfigurationFile(): JavaClasses.File | undefined;
/**
* The folder that is considered the working folder of the current context.
*
* 1) If a configuration file was used, returns the path of the configuration file;
* 2) Otherwise, returns the folder from where the weaver was launched.
*
* @returns The folder where the code represented by the AST will be written at the end of execution.
*/
getContextFolder(): JavaClasses.File;
}
//# sourceMappingURL=DataStore.d.ts.map