@ -34,36 +34,45 @@ inline Status check_if_jlong_fits_size_t(const jlong& jvalue) {
return s ;
return s ;
}
}
// The portal class for org.rocksdb.RocksDB
// Native class template
class RocksDBJni {
template < class PTR , class DERIVED > class RocksDBNativeClass {
public :
public :
// Get the java class id of org.rocksdb.RocksDB.
// Get the java class id
static jclass getJClass ( JNIEnv * env ) {
static jclass getJClass ( JNIEnv * env , const char * jclazz_name ) {
jclass jclazz = env - > FindClass ( " org/rocksdb/RocksDB " ) ;
jclass jclazz = env - > FindClass ( jclazz_name ) ;
assert ( jclazz ! = nullptr ) ;
assert ( jclazz ! = nullptr ) ;
return jclazz ;
return jclazz ;
}
}
// Get the field id of the member variable of org.rocksdb.RocksDB
// Get the field id of the member variable to store
// that stores th e poin te r to rocksdb::DB.
// the ptr
static jfieldID getHandleFieldID ( JNIEnv * env ) {
static jfieldID getHandleFieldID ( JNIEnv * env ) {
static jfieldID fid = env - > GetFieldID (
static jfieldID fid = env - > GetFieldID (
getJClass ( env ) , " nativeHandle_ " , " J " ) ;
DERIVED : : getJClass ( env ) , " nativeHandle_ " , " J " ) ;
assert ( fid ! = nullptr ) ;
assert ( fid ! = nullptr ) ;
return fid ;
return fid ;
}
}
// Get the pointer to rocksdb::DB of the specified org.rocksdb.RocksDB.
// Get the pointer from Java
static rocksdb : : DB * getHandle ( JNIEnv * env , jobject jdb ) {
static PTR getHandle ( JNIEnv * env , jobject jobj ) {
return reinterpret_cast < rocksdb : : DB * > (
return reinterpret_cast < PTR > (
env - > GetLongField ( jdb , getHandleFieldID ( env ) ) ) ;
env - > GetLongField ( jobj , getHandleFieldID ( env ) ) ) ;
}
}
// Pass the rocksdb::DB pointer to the java side.
// Pass the pointer to the java side.
static void setHandle ( JNIEnv * env , jobject jdb , rocksdb : : DB * db ) {
static void setHandle ( JNIEnv * env , jobject jdb , PTR ptr ) {
env - > SetLongField (
env - > SetLongField (
jdb , getHandleFieldID ( env ) ,
jdb , getHandleFieldID ( env ) ,
reinterpret_cast < jlong > ( db ) ) ;
reinterpret_cast < jlong > ( ptr ) ) ;
}
} ;
// The portal class for org.rocksdb.RocksDB
class RocksDBJni : public RocksDBNativeClass < rocksdb : : DB * , RocksDBJni > {
public :
// Get the java class id of org.rocksdb.RocksDB.
static jclass getJClass ( JNIEnv * env ) {
return RocksDBNativeClass : : getJClass ( env , " org/rocksdb/RocksDB " ) ;
}
}
} ;
} ;
@ -96,67 +105,21 @@ class RocksDBExceptionJni {
}
}
} ;
} ;
class OptionsJni {
// The portal class for org.rocksdb.Options
class OptionsJni : public RocksDBNativeClass < rocksdb : : Options * ,
OptionsJni > {
public :
public :
// Get the java class id of org.rocksdb.Options.
static jclass getJClass ( JNIEnv * env ) {
static jclass getJClass ( JNIEnv * env ) {
jclass jclazz = env - > FindClass ( " org/rocksdb/Options " ) ;
return RocksDBNativeClass : : getJClass ( env , " org/rocksdb/Options " ) ;
assert ( jclazz ! = nullptr ) ;
return jclazz ;
}
// Get the field id of the member variable of org.rocksdb.Options
// that stores the pointer to rocksdb::Options
static jfieldID getHandleFieldID ( JNIEnv * env ) {
static jfieldID fid = env - > GetFieldID (
getJClass ( env ) , " nativeHandle_ " , " J " ) ;
assert ( fid ! = nullptr ) ;
return fid ;
}
// Get the pointer to rocksdb::Options
static rocksdb : : Options * getHandle ( JNIEnv * env , jobject jobj ) {
return reinterpret_cast < rocksdb : : Options * > (
env - > GetLongField ( jobj , getHandleFieldID ( env ) ) ) ;
}
// Pass the rocksdb::Options pointer to the java side.
static void setHandle ( JNIEnv * env , jobject jobj , rocksdb : : Options * op ) {
env - > SetLongField (
jobj , getHandleFieldID ( env ) ,
reinterpret_cast < jlong > ( op ) ) ;
}
}
} ;
} ;
class DBOptionsJni {
// The portal class for org.rocksdb.DBOptions
class DBOptionsJni : public RocksDBNativeClass < rocksdb : : DBOptions * ,
DBOptionsJni > {
public :
public :
// Get the java class id of org.rocksdb.DBOptions.
static jclass getJClass ( JNIEnv * env ) {
static jclass getJClass ( JNIEnv * env ) {
jclass jclazz = env - > FindClass ( " org/rocksdb/DBOptions " ) ;
return RocksDBNativeClass : : getJClass ( env , " org/rocksdb/DBOptions " ) ;
assert ( jclazz ! = nullptr ) ;
return jclazz ;
}
// Get the field id of the member variable of org.rocksdb.DBOptions
// that stores the pointer to rocksdb::DBOptions
static jfieldID getHandleFieldID ( JNIEnv * env ) {
static jfieldID fid = env - > GetFieldID (
getJClass ( env ) , " nativeHandle_ " , " J " ) ;
assert ( fid ! = nullptr ) ;
return fid ;
}
// Get the pointer to rocksdb::DBOptions
static rocksdb : : DBOptions * getHandle ( JNIEnv * env , jobject jobj ) {
return reinterpret_cast < rocksdb : : DBOptions * > (
env - > GetLongField ( jobj , getHandleFieldID ( env ) ) ) ;
}
// Pass the rocksdb::DBOptions pointer to the java side.
static void setHandle ( JNIEnv * env , jobject jobj , rocksdb : : DBOptions * op ) {
env - > SetLongField (
jobj , getHandleFieldID ( env ) ,
reinterpret_cast < jlong > ( op ) ) ;
}
}
} ;
} ;
@ -188,149 +151,54 @@ class ColumnFamilyDescriptorJni {
}
}
} ;
} ;
class ColumnFamilyOptionsJni {
// The portal class for org.rocksdb.ColumnFamilyOptions
class ColumnFamilyOptionsJni : public RocksDBNativeClass <
rocksdb : : ColumnFamilyOptions * , ColumnFamilyOptionsJni > {
public :
public :
// Get the java class id of org.rocksdb.ColumnFamilyOptions.
static jclass getJClass ( JNIEnv * env ) {
static jclass getJClass ( JNIEnv * env ) {
jclass jclazz = env - > FindClass ( " org/rocksdb/ColumnFamilyOptions " ) ;
return RocksDBNativeClass : : getJClass ( env ,
assert ( jclazz ! = nullptr ) ;
" org/rocksdb/ColumnFamilyOptions " ) ;
return jclazz ;
}
// Get the field id of the member variable of org.rocksdb.DBOptions
// that stores the pointer to rocksdb::ColumnFamilyOptions
static jfieldID getHandleFieldID ( JNIEnv * env ) {
static jfieldID fid = env - > GetFieldID (
getJClass ( env ) , " nativeHandle_ " , " J " ) ;
assert ( fid ! = nullptr ) ;
return fid ;
}
// Get the pointer to rocksdb::ColumnFamilyOptions
static rocksdb : : ColumnFamilyOptions * getHandle ( JNIEnv * env , jobject jobj ) {
return reinterpret_cast < rocksdb : : ColumnFamilyOptions * > (
env - > GetLongField ( jobj , getHandleFieldID ( env ) ) ) ;
}
// Pass the rocksdb::ColumnFamilyOptions pointer to the java side.
static void setHandle ( JNIEnv * env , jobject jobj ,
rocksdb : : ColumnFamilyOptions * op ) {
env - > SetLongField (
jobj , getHandleFieldID ( env ) ,
reinterpret_cast < jlong > ( op ) ) ;
}
}
} ;
} ;
class WriteOptionsJni {
// The portal class for org.rocksdb.WriteOptions
class WriteOptionsJni : public RocksDBNativeClass <
rocksdb : : WriteOptions * , WriteOptionsJni > {
public :
public :
// Get the java class id of org.rocksdb.WriteOptions.
static jclass getJClass ( JNIEnv * env ) {
static jclass getJClass ( JNIEnv * env ) {
jclass jclazz = env - > FindClass ( " org/rocksdb/WriteOptions " ) ;
return RocksDBNativeClass : : getJClass ( env ,
assert ( jclazz ! = nullptr ) ;
" org/rocksdb/WriteOptions " ) ;
return jclazz ;
}
// Get the field id of the member variable of org.rocksdb.WriteOptions
// that stores the pointer to rocksdb::WriteOptions
static jfieldID getHandleFieldID ( JNIEnv * env ) {
static jfieldID fid = env - > GetFieldID (
getJClass ( env ) , " nativeHandle_ " , " J " ) ;
assert ( fid ! = nullptr ) ;
return fid ;
}
// Get the pointer to rocksdb::WriteOptions
static rocksdb : : WriteOptions * getHandle ( JNIEnv * env , jobject jobj ) {
return reinterpret_cast < rocksdb : : WriteOptions * > (
env - > GetLongField ( jobj , getHandleFieldID ( env ) ) ) ;
}
// Pass the rocksdb::WriteOptions pointer to the java side.
static void setHandle ( JNIEnv * env , jobject jobj , rocksdb : : WriteOptions * op ) {
env - > SetLongField (
jobj , getHandleFieldID ( env ) ,
reinterpret_cast < jlong > ( op ) ) ;
}
}
} ;
} ;
// The portal class for org.rocksdb.ReadOptions
class ReadOptionsJni {
class ReadOptionsJni : public RocksDBNativeClass <
rocksdb : : ReadOptions * , ReadOptionsJni > {
public :
public :
// Get the java class id of org.rocksdb.ReadOptions.
static jclass getJClass ( JNIEnv * env ) {
static jclass getJClass ( JNIEnv * env ) {
jclass jclazz = env - > FindClass ( " org/rocksdb/ReadOptions " ) ;
return RocksDBNativeClass : : getJClass ( env ,
assert ( jclazz ! = nullptr ) ;
" org/rocksdb/ReadOptions " ) ;
return jclazz ;
}
// Get the field id of the member variable of org.rocksdb.ReadOptions
// that stores the pointer to rocksdb::ReadOptions
static jfieldID getHandleFieldID ( JNIEnv * env ) {
static jfieldID fid = env - > GetFieldID (
getJClass ( env ) , " nativeHandle_ " , " J " ) ;
assert ( fid ! = nullptr ) ;
return fid ;
}
// Get the pointer to rocksdb::ReadOptions
static rocksdb : : ReadOptions * getHandle ( JNIEnv * env , jobject jobj ) {
return reinterpret_cast < rocksdb : : ReadOptions * > (
env - > GetLongField ( jobj , getHandleFieldID ( env ) ) ) ;
}
// Pass the rocksdb::ReadOptions pointer to the java side.
static void setHandle ( JNIEnv * env , jobject jobj ,
rocksdb : : ReadOptions * op ) {
env - > SetLongField (
jobj , getHandleFieldID ( env ) ,
reinterpret_cast < jlong > ( op ) ) ;
}
}
} ;
} ;
// The portal class for org.rocksdb.ReadOptions
class WriteBatchJni {
class WriteBatchJni : public RocksDBNativeClass <
rocksdb : : WriteBatch * , WriteBatchJni > {
public :
public :
static jclass getJClass ( JNIEnv * env ) {
static jclass getJClass ( JNIEnv * env ) {
jclass jclazz = env - > FindClass ( " org/rocksdb/WriteBatch " ) ;
return RocksDBNativeClass : : getJClass ( env ,
assert ( jclazz ! = nullptr ) ;
" org/rocksdb/WriteBatch " ) ;
return jclazz ;
}
static jfieldID getHandleFieldID ( JNIEnv * env ) {
static jfieldID fid = env - > GetFieldID (
getJClass ( env ) , " nativeHandle_ " , " J " ) ;
assert ( fid ! = nullptr ) ;
return fid ;
}
// Get the pointer to rocksdb::WriteBatch of the specified
// org.rocksdb.WriteBatch.
static rocksdb : : WriteBatch * getHandle ( JNIEnv * env , jobject jwb ) {
return reinterpret_cast < rocksdb : : WriteBatch * > (
env - > GetLongField ( jwb , getHandleFieldID ( env ) ) ) ;
}
// Pass the rocksdb::WriteBatch pointer to the java side.
static void setHandle ( JNIEnv * env , jobject jwb , rocksdb : : WriteBatch * wb ) {
env - > SetLongField (
jwb , getHandleFieldID ( env ) ,
reinterpret_cast < jlong > ( wb ) ) ;
}
}
} ;
} ;
class WriteBatchHandlerJni {
// The portal class for org.rocksdb.WriteBatch.Handler
class WriteBatchHandlerJni : public RocksDBNativeClass <
const rocksdb : : WriteBatchHandlerJniCallback * ,
WriteBatchHandlerJni > {
public :
public :
static jclass getJClass ( JNIEnv * env ) {
static jclass getJClass ( JNIEnv * env ) {
jclass jclazz = env - > FindClass ( " org/rocksdb/WriteBatch$Handler " ) ;
return RocksDBNativeClass : : getJClass ( env ,
assert ( jclazz ! = nullptr ) ;
" org/rocksdb/WriteBatch$Handler " ) ;
return jclazz ;
}
static jfieldID getHandleFieldID ( JNIEnv * env ) {
static jfieldID fid = env - > GetFieldID (
getJClass ( env ) , " nativeHandle_ " , " J " ) ;
assert ( fid ! = nullptr ) ;
return fid ;
}
}
// Get the java method `put` of org.rocksdb.WriteBatch.Handler.
// Get the java method `put` of org.rocksdb.WriteBatch.Handler.
@ -372,53 +240,15 @@ class WriteBatchHandlerJni {
assert ( mid ! = nullptr ) ;
assert ( mid ! = nullptr ) ;
return mid ;
return mid ;
}
}
// Get the pointer to rocksdb::WriteBatchHandlerJniCallback of the specified
// org.rocksdb.WriteBatchHandler.
static rocksdb : : WriteBatchHandlerJniCallback * getHandle (
JNIEnv * env , jobject jobj ) {
return reinterpret_cast < rocksdb : : WriteBatchHandlerJniCallback * > (
env - > GetLongField ( jobj , getHandleFieldID ( env ) ) ) ;
}
// Pass the rocksdb::WriteBatchHandlerJniCallback pointer to the java side.
static void setHandle (
JNIEnv * env , jobject jobj ,
const rocksdb : : WriteBatchHandlerJniCallback * op ) {
env - > SetLongField (
jobj , getHandleFieldID ( env ) ,
reinterpret_cast < jlong > ( op ) ) ;
}
} ;
} ;
class WriteBatchWithIndexJni {
// The portal class for org.rocksdb.WriteBatchWithIndex
class WriteBatchWithIndexJni : public RocksDBNativeClass <
rocksdb : : WriteBatchWithIndex * , WriteBatchWithIndexJni > {
public :
public :
static jclass getJClass ( JNIEnv * env ) {
static jclass getJClass ( JNIEnv * env ) {
jclass jclazz = env - > FindClass ( " org/rocksdb/WriteBatchWithIndex " ) ;
return RocksDBNativeClass : : getJClass ( env ,
assert ( jclazz ! = nullptr ) ;
" org/rocksdb/WriteBatch " ) ;
return jclazz ;
}
static jfieldID getHandleFieldID ( JNIEnv * env ) {
static jfieldID fid = env - > GetFieldID (
getJClass ( env ) , " nativeHandle_ " , " J " ) ;
assert ( fid ! = nullptr ) ;
return fid ;
}
// Get the pointer to rocksdb::WriteBatchWithIndex of the specified
// org.rocksdb.WriteBatchWithIndex.
static rocksdb : : WriteBatchWithIndex * getHandle ( JNIEnv * env , jobject jwbwi ) {
return reinterpret_cast < rocksdb : : WriteBatchWithIndex * > (
env - > GetLongField ( jwbwi , getHandleFieldID ( env ) ) ) ;
}
// Pass the rocksdb::WriteBatchWithIndex pointer to the java side.
static void setHandle ( JNIEnv * env , jobject jwbwi ,
rocksdb : : WriteBatchWithIndex * wbwi ) {
env - > SetLongField (
jwbwi , getHandleFieldID ( env ) ,
reinterpret_cast < jlong > ( wbwi ) ) ;
}
}
} ;
} ;
@ -431,212 +261,74 @@ class HistogramDataJni {
}
}
} ;
} ;
class BackupableDBOptionsJni {
// The portal class for org.rocksdb.WriteBatchWithIndex
class BackupableDBOptionsJni : public RocksDBNativeClass <
rocksdb : : BackupableDBOptions * , BackupableDBOptionsJni > {
public :
public :
// Get the java class id of org.rocksdb.BackupableDBOptions.
static jclass getJClass ( JNIEnv * env ) {
static jclass getJClass ( JNIEnv * env ) {
jclass jclazz = env - > FindClass ( " org/rocksdb/BackupableDBOptions " ) ;
return RocksDBNativeClass : : getJClass ( env ,
assert ( jclazz ! = nullptr ) ;
" org/rocksdb/BackupableDBOptions " ) ;
return jclazz ;
}
// Get the field id of the member variable of org.rocksdb.BackupableDBOptions
// that stores the pointer to rocksdb::BackupableDBOptions
static jfieldID getHandleFieldID ( JNIEnv * env ) {
static jfieldID fid = env - > GetFieldID (
getJClass ( env ) , " nativeHandle_ " , " J " ) ;
assert ( fid ! = nullptr ) ;
return fid ;
}
// Get the pointer to rocksdb::BackupableDBOptions
static rocksdb : : BackupableDBOptions * getHandle ( JNIEnv * env , jobject jobj ) {
return reinterpret_cast < rocksdb : : BackupableDBOptions * > (
env - > GetLongField ( jobj , getHandleFieldID ( env ) ) ) ;
}
// Pass the rocksdb::BackupableDBOptions pointer to the java side.
static void setHandle (
JNIEnv * env , jobject jobj , rocksdb : : BackupableDBOptions * op ) {
env - > SetLongField (
jobj , getHandleFieldID ( env ) ,
reinterpret_cast < jlong > ( op ) ) ;
}
}
} ;
} ;
class IteratorJni {
// The portal class for org.rocksdb.RocksIterator
class IteratorJni : public RocksDBNativeClass <
rocksdb : : Iterator * , IteratorJni > {
public :
public :
// Get the java class id of org.rocksdb.Iteartor.
static jclass getJClass ( JNIEnv * env ) {
static jclass getJClass ( JNIEnv * env ) {
jclass jclazz = env - > FindClass ( " org/rocksdb/RocksIterator " ) ;
return RocksDBNativeClass : : getJClass ( env ,
assert ( jclazz ! = nullptr ) ;
" org/rocksdb/RocksIterator " ) ;
return jclazz ;
}
// Get the field id of the member variable of org.rocksdb.Iterator
// that stores the pointer to rocksdb::Iterator.
static jfieldID getHandleFieldID ( JNIEnv * env ) {
static jfieldID fid = env - > GetFieldID (
getJClass ( env ) , " nativeHandle_ " , " J " ) ;
assert ( fid ! = nullptr ) ;
return fid ;
}
// Get the pointer to rocksdb::Iterator.
static rocksdb : : Iterator * getHandle ( JNIEnv * env , jobject jobj ) {
return reinterpret_cast < rocksdb : : Iterator * > (
env - > GetLongField ( jobj , getHandleFieldID ( env ) ) ) ;
}
// Pass the rocksdb::Iterator pointer to the java side.
static void setHandle (
JNIEnv * env , jobject jobj , rocksdb : : Iterator * op ) {
env - > SetLongField (
jobj , getHandleFieldID ( env ) ,
reinterpret_cast < jlong > ( op ) ) ;
}
}
} ;
} ;
class FilterJni {
// The portal class for org.rocksdb.Filter
class FilterJni : public RocksDBNativeClass <
std : : shared_ptr < rocksdb : : FilterPolicy > * , FilterJni > {
public :
public :
// Get the java class id of org.rocksdb.FilterPolicy.
static jclass getJClass ( JNIEnv * env ) {
static jclass getJClass ( JNIEnv * env ) {
jclass jclazz = env - > FindClass ( " org/rocksdb/Filter " ) ;
return RocksDBNativeClass : : getJClass ( env ,
assert ( jclazz ! = nullptr ) ;
" org/rocksdb/Filter " ) ;
return jclazz ;
}
// Get the field id of the member variable of org.rocksdb.Filter
// that stores the pointer to rocksdb::FilterPolicy.
static jfieldID getHandleFieldID ( JNIEnv * env ) {
static jfieldID fid = env - > GetFieldID (
getJClass ( env ) , " nativeHandle_ " , " J " ) ;
assert ( fid ! = nullptr ) ;
return fid ;
}
// Get the pointer to rocksdb::FilterPolicy.
static std : : shared_ptr < rocksdb : : FilterPolicy > * getHandle (
JNIEnv * env , jobject jobj ) {
return reinterpret_cast
< std : : shared_ptr < rocksdb : : FilterPolicy > * > (
env - > GetLongField ( jobj , getHandleFieldID ( env ) ) ) ;
}
// Pass the rocksdb::FilterPolicy pointer to the java side.
static void setHandle (
JNIEnv * env , jobject jobj , std : : shared_ptr < rocksdb : : FilterPolicy > * op ) {
env - > SetLongField (
jobj , getHandleFieldID ( env ) ,
reinterpret_cast < jlong > ( op ) ) ;
}
}
} ;
} ;
class ColumnFamilyHandleJni {
// The portal class for org.rocksdb.ColumnFamilyHandle
class ColumnFamilyHandleJni : public RocksDBNativeClass <
rocksdb : : ColumnFamilyHandle * , ColumnFamilyHandleJni > {
public :
public :
// Get the java class id of org.rocksdb.ColumnFamilyHandle.
static jclass getJClass ( JNIEnv * env ) {
static jclass getJClass ( JNIEnv * env ) {
jclass jclazz = env - > FindClass ( " org/rocksdb/ColumnFamilyHandle " ) ;
return RocksDBNativeClass : : getJClass ( env ,
assert ( jclazz ! = nullptr ) ;
" org/rocksdb/ColumnFamilyHandle " ) ;
return jclazz ;
}
// Get the field id of the member variable of org.rocksdb.ColumnFamilyHandle.
// that stores the pointer to rocksdb::ColumnFamilyHandle.
static jfieldID getHandleFieldID ( JNIEnv * env ) {
static jfieldID fid = env - > GetFieldID (
getJClass ( env ) , " nativeHandle_ " , " J " ) ;
assert ( fid ! = nullptr ) ;
return fid ;
}
// Get the pointer to rocksdb::ColumnFamilyHandle.
static rocksdb : : ColumnFamilyHandle * getHandle ( JNIEnv * env , jobject jobj ) {
return reinterpret_cast < rocksdb : : ColumnFamilyHandle * > (
env - > GetLongField ( jobj , getHandleFieldID ( env ) ) ) ;
}
// Pass the rocksdb::ColumnFamilyHandle pointer to the java side.
static void setHandle (
JNIEnv * env , jobject jobj , const rocksdb : : ColumnFamilyHandle * op ) {
env - > SetLongField (
jobj , getHandleFieldID ( env ) ,
reinterpret_cast < jlong > ( op ) ) ;
}
}
} ;
} ;
class FlushOptionsJni {
// The portal class for org.rocksdb.FlushOptions
class FlushOptionsJni : public RocksDBNativeClass <
rocksdb : : FlushOptions * , FlushOptionsJni > {
public :
public :
// Get the java class id of org.rocksdb.FlushOptions.
static jclass getJClass ( JNIEnv * env ) {
static jclass getJClass ( JNIEnv * env ) {
return RocksDBNativeClass : : getJClass ( env ,
jclass jclazz = env - > FindClass ( " org/rocksdb/FlushOptions " ) ;
" org/rocksdb/FlushOptions " ) ;
assert ( jclazz ! = nullptr ) ;
}
return jclazz ;
}
// Get the field id of the member variable of org.rocksdb.FlushOptions
// that stores the pointer to rocksdb::FlushOptions.
static jfieldID getHandleFieldID ( JNIEnv * env ) {
static jfieldID fid = env - > GetFieldID (
getJClass ( env ) , " nativeHandle_ " , " J " ) ;
assert ( fid ! = nullptr ) ;
return fid ;
}
// Pass the FlushOptions pointer to the java side.
static void setHandle (
JNIEnv * env , jobject jobj ,
const rocksdb : : FlushOptions * op ) {
env - > SetLongField (
jobj , getHandleFieldID ( env ) ,
reinterpret_cast < jlong > ( op ) ) ;
}
} ;
} ;
class ComparatorOptionsJni {
// The portal class for org.rocksdb.ComparatorOptions
class ComparatorOptionsJni : public RocksDBNativeClass <
rocksdb : : ComparatorJniCallbackOptions * , ComparatorOptionsJni > {
public :
public :
// Get the java class id of org.rocksdb.ComparatorOptions.
static jclass getJClass ( JNIEnv * env ) {
static jclass getJClass ( JNIEnv * env ) {
return RocksDBNativeClass : : getJClass ( env ,
jclass jclazz = env - > FindClass ( " org/rocksdb/ComparatorOptions " ) ;
" org/rocksdb/ComparatorOptions " ) ;
assert ( jclazz ! = nullptr ) ;
}
return jclazz ;
}
// Get the field id of the member variable of org.rocksdb.ComparatorOptions
// that stores the pointer to rocksdb::ComparatorJniCallbackOptions.
static jfieldID getHandleFieldID ( JNIEnv * env ) {
static jfieldID fid = env - > GetFieldID (
getJClass ( env ) , " nativeHandle_ " , " J " ) ;
assert ( fid ! = nullptr ) ;
return fid ;
}
// Pass the ComparatorJniCallbackOptions pointer to the java side.
static void setHandle (
JNIEnv * env , jobject jobj ,
const rocksdb : : ComparatorJniCallbackOptions * op ) {
env - > SetLongField (
jobj , getHandleFieldID ( env ) ,
reinterpret_cast < jlong > ( op ) ) ;
}
} ;
} ;
class AbstractComparatorJni {
// The portal class for org.rocksdb.AbstractComparator
class AbstractComparatorJni : public RocksDBNativeClass <
const rocksdb : : BaseComparatorJniCallback * ,
AbstractComparatorJni > {
public :
public :
// Get the java class id of org.rocksdb.Comparator.
static jclass getJClass ( JNIEnv * env ) {
static jclass getJClass ( JNIEnv * env ) {
jclass jclazz = env - > FindClass ( " org/rocksdb/AbstractComparator " ) ;
return RocksDBNativeClass : : getJClass ( env ,
assert ( jclazz ! = nullptr ) ;
" org/rocksdb/AbstractComparator " ) ;
return jclazz ;
}
// Get the field id of the member variable of org.rocksdb.Comparator
// that stores the pointer to rocksdb::Comparator.
static jfieldID getHandleFieldID ( JNIEnv * env ) {
static jfieldID fid = env - > GetFieldID (
getJClass ( env ) , " nativeHandle_ " , " J " ) ;
assert ( fid ! = nullptr ) ;
return fid ;
}
}
// Get the java method `name` of org.rocksdb.Comparator.
// Get the java method `name` of org.rocksdb.Comparator.
@ -673,53 +365,15 @@ class AbstractComparatorJni {
assert ( mid ! = nullptr ) ;
assert ( mid ! = nullptr ) ;
return mid ;
return mid ;
}
}
// Get the pointer to ComparatorJniCallback.
static rocksdb : : BaseComparatorJniCallback * getHandle (
JNIEnv * env , jobject jobj ) {
return reinterpret_cast < rocksdb : : BaseComparatorJniCallback * > (
env - > GetLongField ( jobj , getHandleFieldID ( env ) ) ) ;
}
// Pass the ComparatorJniCallback pointer to the java side.
static void setHandle (
JNIEnv * env , jobject jobj , const rocksdb : : BaseComparatorJniCallback * op ) {
env - > SetLongField (
jobj , getHandleFieldID ( env ) ,
reinterpret_cast < jlong > ( op ) ) ;
}
} ;
} ;
class AbstractSliceJni {
// The portal class for org.rocksdb.AbstractSlice
class AbstractSliceJni : public RocksDBNativeClass <
const rocksdb : : Slice * , AbstractSliceJni > {
public :
public :
// Get the java class id of org.rocksdb.Slice.
static jclass getJClass ( JNIEnv * env ) {
static jclass getJClass ( JNIEnv * env ) {
jclass jclazz = env - > FindClass ( " org/rocksdb/AbstractSlice " ) ;
return RocksDBNativeClass : : getJClass ( env ,
assert ( jclazz ! = nullptr ) ;
" org/rocksdb/AbstractSlice " ) ;
return jclazz ;
}
// Get the field id of the member variable of org.rocksdb.Slice
// that stores the pointer to rocksdb::Slice.
static jfieldID getHandleFieldID ( JNIEnv * env ) {
static jfieldID fid = env - > GetFieldID (
getJClass ( env ) , " nativeHandle_ " , " J " ) ;
assert ( fid ! = nullptr ) ;
return fid ;
}
// Get the pointer to Slice.
static rocksdb : : Slice * getHandle ( JNIEnv * env , jobject jobj ) {
return reinterpret_cast < rocksdb : : Slice * > (
env - > GetLongField ( jobj , getHandleFieldID ( env ) ) ) ;
}
// Pass the Slice pointer to the java side.
static void setHandle (
JNIEnv * env , jobject jobj , const rocksdb : : Slice * op ) {
env - > SetLongField (
jobj , getHandleFieldID ( env ) ,
reinterpret_cast < jlong > ( op ) ) ;
}
}
} ;
} ;