OpenGL ES SDK for Android ARM Developer Center
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MaliSDK::JavaClass Class Reference

Wraps a Java class to allow access to it's static fields and methods using JNI. More...

#include <JavaClass.h>

Public Member Functions

 JavaClass (JNIEnv *JNIEnvironment, const char *classPath)
 Constructor taking the Java environment and the required class path. More...
 
virtual ~JavaClass ()
 
bool staticField (const char *fieldName, char **result)
 Access a static String field of the Java class. More...
 
bool staticField (const char *fieldName, int *result)
 Access a static integer field of the Java class. More...
 
bool staticMethod (const char *methodName, int **returnValue, const char *param01)
 Call a static method with one parameter which returns an integer array within the Java class. More...
 
bool staticMethod (const char *methodName, const char *param01, const char *param02)
 Call a static method with two parameters which doesn't return a value within the Java class. More...
 

Private Attributes

char * classPath
 
jclass jClass
 
JNIEnv * JNIEnvironment
 
bool intialized
 

Detailed Description

Wraps a Java class to allow access to it's static fields and methods using JNI.

Definition at line 42 of file JavaClass.h.

Constructor & Destructor Documentation

MaliSDK::JavaClass::JavaClass ( JNIEnv *  JNIEnvironment,
const char *  classPath 
)

Constructor taking the Java environment and the required class path.

Checks for the existance of the class and prints an error if it can't be found.

Parameters
[in]JNIEnvironmentA pointer to the JNI environment which allows interfacing with the Java Virtual Machine (JVM). Allows extensive interaction with the JVM including accessing Java classes, fields and methods. This pointer is provided as part of a JNI call from Java to C++.
[in]classPathThe class path to the Java class to wrap.

Definition at line 32 of file JavaClass.cpp.

MaliSDK::JavaClass::~JavaClass ( )
virtual

Default destructor.

Definition at line 51 of file JavaClass.cpp.

Member Function Documentation

bool MaliSDK::JavaClass::staticField ( const char *  fieldName,
char **  result 
)

Access a static String field of the Java class.

Parameters
[in]fieldNameThe name of the static field to access.
[out]resultPointer to where the String value of the static field will be placed.
Returns
True if the operation was successful.

Definition at line 59 of file JavaClass.cpp.

bool MaliSDK::JavaClass::staticField ( const char *  fieldName,
int result 
)

Access a static integer field of the Java class.

Parameters
[in]fieldNameThe name of the static field to access.
[out]resultPointer to where the integer value of the static field will be placed.
Returns
True if the operation was successful.

Definition at line 79 of file JavaClass.cpp.

bool MaliSDK::JavaClass::staticMethod ( const char *  methodName,
int **  returnValue,
const char *  param01 
)

Call a static method with one parameter which returns an integer array within the Java class.

Parameters
[in]methodNameThe name of the static method to call.
[out]returnValuePointer to an integer array where the return value of the static method will be placed.
[in]param01A parameter that will be passed to the static method of the Java class.
Returns
True if the operation was successful.

Definition at line 92 of file JavaClass.cpp.

bool MaliSDK::JavaClass::staticMethod ( const char *  methodName,
const char *  param01,
const char *  param02 
)

Call a static method with two parameters which doesn't return a value within the Java class.

Parameters
[in]methodNameThe name of the static method to call.
[in]param01The first parameter that will be passed to the static method of the Java class.
[in]param02The second parameter that will be passed to the static method of the Java class.
Returns
True if the operation was successful.

Definition at line 120 of file JavaClass.cpp.

Member Data Documentation

char* MaliSDK::JavaClass::classPath
private

Definition at line 45 of file JavaClass.h.

bool MaliSDK::JavaClass::intialized
private

Definition at line 48 of file JavaClass.h.

jclass MaliSDK::JavaClass::jClass
private

Definition at line 46 of file JavaClass.h.

JNIEnv* MaliSDK::JavaClass::JNIEnvironment
private

Definition at line 47 of file JavaClass.h.


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