Index: subversion/bindings/javahl/native/SVNBase.cpp =================================================================== --- subversion/bindings/javahl/native/SVNBase.cpp (revision 1328758) +++ subversion/bindings/javahl/native/SVNBase.cpp (working copy) @@ -107,3 +107,29 @@ inline void SVNBase::findCppAddrFieldID(jfieldID *fid, const char *className, } } } + +jobject SVNBase::createCppBoundObject(const char *clazzName) +{ + JNIEnv *env = JNIUtil::getEnv(); + + // Create java session object + jclass clazz = env->FindClass(clazzName); + if (JNIUtil::isJavaExceptionThrown()) + return NULL; + + static jmethodID ctor = 0; + if (ctor == 0) + { + ctor = env->GetMethodID(clazz, "", "(J)V"); + if (JNIUtil::isJavaExceptionThrown()) + return NULL; + } + + jlong cppAddr = this->getCppAddr(); + + jobject jself = env->NewObject(clazz, ctor, cppAddr); + if (JNIUtil::isJavaExceptionThrown()) + return NULL; + + return jself; +} Index: subversion/bindings/javahl/native/SVNBase.h =================================================================== --- subversion/bindings/javahl/native/SVNBase.h (revision 1328758) +++ subversion/bindings/javahl/native/SVNBase.h (working copy) @@ -90,6 +90,11 @@ class SVNBase */ void disconnectCppObject(jobject jthis, jfieldID *fid, const char *className); + /** + * Instantiates java object attached to this base object + */ + jobject createCppBoundObject(const char *clazzName); + private: /** * If the value pointed to by @a fid is zero, find the @c jfieldID