MySQL 5.6.14 Source Code Document
|
#include <jtie_tconv_idcache_impl.hpp>
Public Types | |
typedef C::memberID_t | ID_t |
Static Public Member Functions | |
static void | setClass (JNIEnv *env, jclass cls) |
static jclass | getClass (JNIEnv *env) |
static ID_t | getId (JNIEnv *env, jclass cls) |
static void | releaseRef (JNIEnv *env, jclass cls) |
Static Public Attributes | |
static unsigned long | nIdLookUps = 0 |
Provides uniform access to the JNI Field/Method ID of a Java class member as described by the member info type 'C'.
This base class does not cache the member ID and the class object, but it retrieves the member ID from JNI upon each access; different caching strategies are provided by derived classes.
This class (and its derived classes) impose a strict usage pattern. For example, given definitions...
// Defines the field info type for MyClass.myField. JTIE_DEFINE_FIELD_MEMBER_INFO(_MyClass_myField)
// Provides a (cached) access to field Id of MyClass.myField. typedef JniMemberId< _MyClass_myField > MyClass_myField;
any use of a member ID must be bracketed by getClass() and releaseRef():
// obtain a class reference jclass cls = MyClass_myField::getClass(env); if (cls == NULL) { // exception pending } else { // get the field ID valid along with the class reference jfieldID fid = MyClass_myField::getId(env, cls); if (fid == NULL) { // exception pending } else { // OK to access field using 'fid' } // allow for releasing the class reference MyClass_myField::releaseRef(env, cls); }
Derived classes implement any caching underneath this usage pattern.
Definition at line 156 of file jtie_tconv_idcache_impl.hpp.
|
inlinestatic |
Returns a JNI Reference to the class declaring the member specified by info type 'C'.
Depending upon the underlying caching strategy, a returned reference may be local or global, weak or strong; the scope of its use must be demarcated by releaseRef().
Pre condition:
Post condition:
Reimplemented in MemberIdPreloadedStrongCache< C >, MemberIdPreloadedWeakCache< C >, MemberIdStrongCache< C >, and MemberIdWeakCache< C >.
Definition at line 196 of file jtie_tconv_idcache_impl.hpp.
|
inlinestatic |
Returns the JNI Field/Method ID of a Java class member.
The member ID is only valid along with a class object obtained by getClass() and before releaseRef().
Pre condition:
Post condition:
Reimplemented in MemberIdCache< C >.
Definition at line 239 of file jtie_tconv_idcache_impl.hpp.
|
inlinestatic |
Allows for a class reference to be released along with any member IDs.
Pre condition:
Reimplemented in MemberIdPreloadedWeakCache< C >, MemberIdStrongCache< C >, and MemberIdWeakCache< C >.
Definition at line 254 of file jtie_tconv_idcache_impl.hpp.
|
inlinestatic |
Allows for storing a (global) class reference.
Usually only called from getClass(), but enables "cache preloading" from a (native, static) function called at class initialization.
Pre condition:
Reimplemented in MemberIdStrongCache< C >, and MemberIdWeakCache< C >.
Definition at line 172 of file jtie_tconv_idcache_impl.hpp.