GraphLab: Distributed Graph-Parallel API  2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
graphlab::java_any Class Reference

#include <graphlab/jni/java_any.hpp>

List of all members.

Public Member Functions

 java_any (JNIEnv *env, jobject &obj)
 java_any ()
 java_any (const java_any &other)
java_anyoperator= (const java_any &other)
jobject & obj ()
const jobject & obj () const
 ~java_any ()

Protected Member Functions

void set_obj (jobject obj)
bool handle_exception (JNIEnv *env) const

Detailed Description

Generic wrapper for Java objects (jobject). It creates a NewGlobalRef on the jobject in the default constructor, and deletes the GlobalRef in the destructor. An assignment operator is also provided to deal with creating and deleting edges. Subclasses should provide a copy constructor, and there are two scenarios: NewGlobalRef during copy, or object clone during copy.

Definition at line 42 of file java_any.hpp.


Constructor & Destructor Documentation

java_any::java_any ( JNIEnv *  env,
jobject &  obj 
)

Constructor for java_any. Initializes this object with the associated Java object.

Parameters:
[in]envJNI environment - used to create a new reference to obj
[in]objJava object. This constructor will create a new reference to the object to prevent garbage collection.

Definition at line 39 of file java_any.cpp.

java_any::java_any ( )

The default constructor does nothing. mobj is initialized to NULL.

Definition at line 44 of file java_any.cpp.

java_any::java_any ( const java_any other)

Copy constructor If other has a reference to a java object, increases the reference count. Child classes may wish to override this to implement clone behavior.

Definition at line 54 of file java_any.cpp.

java_any::~java_any ( )

Deletes the reference to the Java object so that it may be garbage collected.

Definition at line 109 of file java_any.cpp.


Member Function Documentation

bool java_any::handle_exception ( JNIEnv *  env) const
protected

Checks for and rethrows Java exceptions.

Parameters:
[in]envJNI environment
Returns:
true if exception was found; false otherwise

Definition at line 117 of file java_any.cpp.

jobject & java_any::obj ( )

Retrieves the associated Java object

Definition at line 46 of file java_any.cpp.

java_any & java_any::operator= ( const java_any other)

Copy assignment operator for java_any. If other has a mobj, creates a new reference to it.

Definition at line 68 of file java_any.cpp.

void java_any::set_obj ( jobject  obj)
protected

Deletes the current ref (if any) and creates a new ref if obj is not null.

Parameters:
[in]objreplaces current object ref

Definition at line 93 of file java_any.cpp.


The documentation for this class was generated from the following files: