Class JKGitDataAccess

java.lang.Object
com.jk.data.dataaccess.git.JKGitDataAccess

public class JKGitDataAccess extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> void
    delete(T record)
    This method deletes a record from the Git-backed storage.
    <T> T
    find(Class<T> clas, Object id)
    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>
    getList(Class<T> clas)
    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
    save(Class<T> clas, List<T> list)
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public <T> T find(Class<T> clas, Object id)
      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

      public <T> List<T> getList(Class<T> clas)
      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

      protected <T> void save(Class<T> clas, List<T> list)
      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

      protected <T> String getFilePath(Class<T> clas)
      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.