NebulaStream  0.6.213
NebulaStream is a data and application management framework for the internet of things
NES::jni Namespace Reference

This header provides basic functions that simplify the interaction with a JVM over JNI. More...

Classes

class  JVM
 
class  NameResolutionException
 
class  InitializationException
 

Typedefs

typedef JNIEnv_ JNIEnv
 
typedef JavaVM_ JavaVM
 
typedef _jobject * jobject
 
typedef _jclass * jclass
 
typedef _jarray * jarray
 
typedef _jstring * jstring
 
typedef struct _jmethodID * jmethodID
 
using JavaSerializedInstance = std::vector< char >
 
using JavaByteCode = std::vector< char >
 
using JavaClassDefinition = std::pair< std::string, JavaByteCode >
 
using JavaUDFByteCodeList = std::vector< JavaClassDefinition >
 

Functions

JNIEnvgetEnv ()
 
void detachEnv ()
 Detachs the current thread from the jvm and removes all local references. More...
 
void jniErrorCheck (const std::source_location location=std::source_location::current())
 Checks for a pending exception in the JNI environment and throws a runtime error if one is found. More...
 
void freeObject (jobject object)
 
jobject allocateObject (jclass clazz)
 Allocates a new object instance for to a specific class. More...
 
jclass findClass (const std::string_view &clazzName)
 Finds a class with a given name. More...
 
jmethodID getMethod (jclass clazz, const std::string_view &methodName, const std::string_view &signature)
 Finds a method with a given name. More...
 
jobject createBoolean (bool value)
 Creates a java.lang.Boolean object for a given bool. More...
 
jobject createFloat (float value)
 Creates a java.lang.Float object for a given float. More...
 
jobject createDouble (double value)
 Creates a java.lang.Double object for a given double. More...
 
jobject createInteger (int32_t value)
 Creates a java.lang.Integer object for a given int32_t. More...
 
jobject createLong (int64_t value)
 Creates a java.lang.Long object for a given int64_t. More...
 
jobject createShort (int16_t value)
 Creates a java.lang.Short object for a given int16_t. More...
 
jobject createByte (int8_t value)
 Creates a java.lang.Byte object for a given int8_t. More...
 
jstring createString (const std::string_view &value)
 Creates a java.lang.String object for a given std::string_view. More...
 
bool getBooleanValue (jobject object)
 Extracts a bool from a java.lang.Boolean object. More...
 
float getFloatValue (jobject object)
 Extracts a float from a java.lang.Float object. More...
 
double getDoubleValue (jobject object)
 Extracts a double from a java.lang.Double object. More...
 
int32_t getIntegerValue (jobject object)
 Extracts a int32_t from a java.lang.Integer object. More...
 
int64_t getLongValue (jobject object)
 Extracts a int64_t from a java.lang.Long object. More...
 
int16_t getShortValue (jobject object)
 Extracts a int16_t from a java.lang.Short object. More...
 
int8_t getByteValue (jobject object)
 Extracts a int8_t from a java.lang.Byte object. More...
 
std::string getStringObjectValue (jstring object)
 Extracts a std::string from a java.lang.String object. More...
 
const std::string convertToJNIName (const std::string &javaClassName)
 Converts a class name into the correct jni name. More...
 

Detailed Description

This header provides basic functions that simplify the interaction with a JVM over JNI.

Typedef Documentation

◆ jarray

typedef _jarray* NES::jni::jarray

◆ JavaByteCode

using NES::jni::JavaByteCode = typedef std::vector<char>

◆ JavaClassDefinition

using NES::jni::JavaClassDefinition = typedef std::pair<std::string, JavaByteCode>

◆ JavaSerializedInstance

using NES::jni::JavaSerializedInstance = typedef std::vector<char>

◆ JavaUDFByteCodeList

using NES::jni::JavaUDFByteCodeList = typedef std::vector<JavaClassDefinition>

◆ JavaVM

typedef JavaVM_ NES::jni::JavaVM

◆ jclass

typedef _jclass* NES::jni::jclass

◆ jmethodID

typedef struct _jmethodID* NES::jni::jmethodID

◆ JNIEnv

typedef JNIEnv_ NES::jni::JNIEnv

◆ jobject

typedef _jobject* NES::jni::jobject

◆ jstring

typedef _jstring* NES::jni::jstring

Function Documentation

◆ allocateObject()

jobject NES::jni::allocateObject ( jclass  clazz)

Allocates a new object instance for to a specific class.

Parameters
clazz
Returns
jobject

◆ convertToJNIName()

const std::string NES::jni::convertToJNIName ( const std::string &  javaClassName)

Converts a class name into the correct jni name.

Parameters
javaClassName
Returns
std::string

◆ createBoolean()

jobject NES::jni::createBoolean ( bool  value)

Creates a java.lang.Boolean object for a given bool.

Parameters
value
Returns
jobject

Referenced by NES::TEST_F().

Here is the caller graph for this function:

◆ createByte()

jobject NES::jni::createByte ( int8_t  value)

Creates a java.lang.Byte object for a given int8_t.

Parameters
value
Returns
jobject

◆ createDouble()

jobject NES::jni::createDouble ( double  value)

Creates a java.lang.Double object for a given double.

Parameters
value
Returns
jobject

Referenced by NES::TEST_F().

Here is the caller graph for this function:

◆ createFloat()

jobject NES::jni::createFloat ( float  value)

Creates a java.lang.Float object for a given float.

Parameters
value
Returns
jobject

Referenced by NES::TEST_F().

Here is the caller graph for this function:

◆ createInteger()

jobject NES::jni::createInteger ( int32_t  value)

Creates a java.lang.Integer object for a given int32_t.

Parameters
value
Returns
jobject

Referenced by NES::TEST_F().

Here is the caller graph for this function:

◆ createLong()

jobject NES::jni::createLong ( int64_t  value)

Creates a java.lang.Long object for a given int64_t.

Parameters
value
Returns
jobject

◆ createShort()

jobject NES::jni::createShort ( int16_t  value)

Creates a java.lang.Short object for a given int16_t.

Parameters
value
Returns
jobject

◆ createString()

jstring NES::jni::createString ( const std::string_view &  value)

Creates a java.lang.String object for a given std::string_view.

Parameters
value
Returns
jobject

◆ detachEnv()

void NES::jni::detachEnv ( )

Detachs the current thread from the jvm and removes all local references.

◆ findClass()

jclass NES::jni::findClass ( const std::string_view &  clazzName)

Finds a class with a given name.

Parameters
clazzName
Returns
jclass

◆ freeObject()

void NES::jni::freeObject ( jobject  object)

Free a jvm object

Parameters
objectobject to free

◆ getBooleanValue()

bool NES::jni::getBooleanValue ( jobject  object)

Extracts a bool from a java.lang.Boolean object.

Parameters
object
Returns
bool

◆ getByteValue()

int8_t NES::jni::getByteValue ( jobject  object)

Extracts a int8_t from a java.lang.Byte object.

Parameters
object
Returns
int8_t

◆ getDoubleValue()

double NES::jni::getDoubleValue ( jobject  object)

Extracts a double from a java.lang.Double object.

Parameters
object
Returns
double

◆ getEnv()

JNIEnv* NES::jni::getEnv ( )

Get the appropriate JNI environment for this thread.

◆ getFloatValue()

float NES::jni::getFloatValue ( jobject  object)

Extracts a float from a java.lang.Float object.

Parameters
object
Returns
float

◆ getIntegerValue()

int32_t NES::jni::getIntegerValue ( jobject  object)

Extracts a int32_t from a java.lang.Integer object.

Parameters
object
Returns
int32_t

◆ getLongValue()

int64_t NES::jni::getLongValue ( jobject  object)

Extracts a int64_t from a java.lang.Long object.

Parameters
object
Returns
bool

◆ getMethod()

jmethodID NES::jni::getMethod ( jclass  clazz,
const std::string_view &  methodName,
const std::string_view &  signature 
)

Finds a method with a given name.

Parameters
methodName
Returns
jmethodID

◆ getShortValue()

int16_t NES::jni::getShortValue ( jobject  object)

Extracts a int16_t from a java.lang.Short object.

Parameters
object
Returns
int16_t

◆ getStringObjectValue()

std::string NES::jni::getStringObjectValue ( jstring  object)

Extracts a std::string from a java.lang.String object.

Parameters
object
Returns
std::string

◆ jniErrorCheck()

void NES::jni::jniErrorCheck ( const std::source_location  location = std::source_location::current())

Checks for a pending exception in the JNI environment and throws a runtime error if one is found.

Parameters
source_locationsource_location of callee