Package org.telegram.abilitybots.api.db
Class MapDBContext
java.lang.Object
org.telegram.abilitybots.api.db.MapDBContext
- All Implemented Interfaces:
Closeable
,AutoCloseable
,DBContext
An implementation of
DBContext
that relies on a DB
.- Author:
- Abbas Abou Daya
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbackup()
Implementations of this method are free to return any object such as XML, JSON, etc...void
clear()
Clears the data structures present in the database.void
close()
void
commit()
Commits the database to its persistent layer.boolean
<T> List<T>
<K,
V> Map<K, V> <T> Set<T>
<T> Var<T>
static DBContext
offlineInstance
(String name) This DB returned by this method gets deleted on JVM shutdown.static DBContext
onlineInstance
(String name) This DB returned by this method does not trigger deletion on JVM shutdown.boolean
The object passed to this method need to conform to the implementation of theDBContext.backup()
method.summary()
-
Constructor Details
-
MapDBContext
public MapDBContext(org.mapdb.DB db)
-
-
Method Details
-
onlineInstance
This DB returned by this method does not trigger deletion on JVM shutdown.- Parameters:
name
- name of the DB file- Returns:
- an online instance of
MapDBContext
-
offlineInstance
This DB returned by this method gets deleted on JVM shutdown.- Parameters:
name
- name of the DB file- Returns:
- an offline instance of
MapDBContext
-
getList
-
getMap
-
getSet
-
getVar
-
summary
-
backup
Description copied from interface:DBContext
Implementations of this method are free to return any object such as XML, JSON, etc... -
recover
Description copied from interface:DBContext
The object passed to this method need to conform to the implementation of theDBContext.backup()
method. -
info
-
commit
public void commit()Description copied from interface:DBContext
Commits the database to its persistent layer. Implementations are free to not implement this method as it is not compulsory. -
clear
public void clear()Description copied from interface:DBContext
Clears the data structures present in the database.This method does not delete the data-structure themselves, but leaves them empty.
-
contains
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-