Package com.jk.data.dataaccess.git
Class JKGitDataAccess
java.lang.Object
com.jk.data.dataaccess.git.JKGitDataAccess
This class provides basic data access operations for managing records in a
Git-backed storage.
It allows for record insertion, retrieval, update, and deletion, all of which are synchronized with a Git repository.
- Version:
- 1.0
- Author:
- Dr. Jalal H. Kiswani
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> void
delete
(T record) This method deletes a record from the Git-backed storage.<T> T
This method finds a record of the specified class with the given unique identifier.protected <T> String
getFilePath
(Class<T> clas) This method gets the file path for storing records of a specified class.<T> List<T>
This method retrieves a list of records of the specified class from the Git-backed storage.<T> void
insert
(T record) This method inserts a new record into the Git-backed storage.protected <T> void
This method saves a list of records to the Git-backed storage.<T> void
update
(T record) This method updates an existing record in the Git-backed storage.
-
Constructor Details
-
JKGitDataAccess
public JKGitDataAccess()
-
-
Method Details
-
insert
public <T> void insert(T record) This method inserts a new record into the Git-backed storage.- Type Parameters:
T
- Specifies the type of the record to be inserted.- Parameters:
record
- Specifies the record to be inserted.
-
find
This method finds a record of the specified class with the given unique identifier.- Type Parameters:
T
- Specifies the type of the record.- Parameters:
clas
- Specifies the class type of the record.id
- Specifies the unique identifier of the record.- Returns:
- the found record or null if not found.
-
update
public <T> void update(T record) This method updates an existing record in the Git-backed storage.- Type Parameters:
T
- Specifies the type of record.- Parameters:
record
- Specifies the record to be updated.
-
delete
public <T> void delete(T record) This method deletes a record from the Git-backed storage.- Type Parameters:
T
- Specifies the type of the record.- Parameters:
record
- Specifies the record to be deleted.
-
getList
This method retrieves a list of records of the specified class from the Git-backed storage.- Type Parameters:
T
- Specifies the type of the record.- Parameters:
clas
- Specifies the class type of the records to retrieve.- Returns:
- the list of records of the specified class, or an empty list if no records are found.
-
save
This method saves a list of records to the Git-backed storage.- Type Parameters:
T
- Specifies the type of the record.- Parameters:
clas
- Specifies the class type of the records.list
- Specifies the list of records to save.
-
getFilePath
This method gets the file path for storing records of a specified class.- Type Parameters:
T
- Specifies the type of the record.- Parameters:
clas
- Specifies the class type of the records.- Returns:
- the file path where records of the specified class are stored.
-