#include <xmog_java_class.h>
Inheritance diagram for xmog_java_class:


Public Types | |
| typedef xmog_java_ref *(XMOG_CALLING_CONVENTION * | XMOG_FACTORY_METHOD )(jobject obj, xmog_flags src, xmog_flags dest, const char *classNameUTF, xmog_localenv *env) |
| A typedef for the method that can be used to return a heap-allocated instance of a proxy type based on a JNI reference. | |
| typedef xmog_java_ref *(XMOG_CALLING_CONVENTION * | XMOG_FROMJAVA_METHOD )(xmog_java_ref *jobj, xmog_localenv *env) |
| A typedef for the method that can be used to perform custom object initialization for a proxy type that is being created for an existing Java object. | |
| typedef xmog_interceptor_result(XMOG_CALLING_CONVENTION * | XMOG_INTERCEPTOR )(xmog_base *obj, xmog_java_dynamic *dyn, xmog_java_values *vals, xmog_interceptor_when when, xmog_interceptor_what what, xmog_java_value *result, xmog_localenv *env, xmog_flags &flags) |
| A typedef for a method that can be registered to handle or augment the processing of proxy API calls. | |
| enum | xmog_interceptor_result { IcpDoneWithResult = 1, IcpContinue = 0, IcpError = -1 } |
| A value used to signal further interceptor processing requirements. More... | |
| enum | xmog_interceptor_what { IcpFieldGet = 0, IcpFieldSet = 1, IcpMethod = 2, IcpCtor = 3, IcpArrayCreate = 4, IcpArrayGet = 5, IcpArraySet = 6, IcpStringFromNativeChars = 7, IcpNativeCharsFromString = 8, IcpIsNull = 9, IcpIsInstanceOf = 10, IcpSpecial = 16 } |
| A value used to signal the interceptor type. More... | |
| enum | xmog_interceptor_when { IcpBefore = 0, IcpAfter = 1 } |
| A value used to signal the interceptor call reason. More... | |
| typedef void(XMOG_CALLING_CONVENTION * | XMOG_THROW_METHOD )(jobject exc, xmog_flags flags) |
| A typedef for the method that can be used to throw an exception. | |
| typedef xmog_java_ref *(XMOG_CALLING_CONVENTION * | XMOG_TOJAVA_METHOD )(xmog_java_ref *nobj, xmog_localenv *env) |
| A typedef for the method that can be used to perform custom object conversion for a native type that is being transformed into a Java object. | |
Public Member Functions | |
| void | add_field (xmog_java_field *_field) |
| Adds a field to the list of fields that this instance is aware of. | |
| void | add_method (xmog_java_method *_method) |
| Adds a method to the list of methods that this instance is aware of. | |
| jobject | from (const xmog_base &srcInstance, xmog_flags flags=xmog_base::GLOBAL, xmog_localenv *env=NULL) |
Returns an object reference or null if the given instance is incompatible with this class. | |
| xmog_java_class * | get_array_class () |
| Returns the xmog_java_class instance that represents the array type for this instance's represented type. | |
| const char * | get_class_name () const |
| Returns the class name. | |
| xmog_java_field * | get_fields () |
| Returns a pointer to the first field. | |
| jint | get_hashcode (xmog_localenv *env=NULL) |
| Returns the instance's hashcode. | |
| jclass | get_jclass (xmog_localenv *env, bool bSuppressExceptions) |
| Returns the internal JNI reference to the type. | |
| jclass | get_jclass (xmog_localenv *env=NULL) |
| Returns the internal JNI reference to the type. | |
| xmog_java_method * | get_methods () |
| Returns a pointer to the first method or constructor. | |
| const char * | getClassName (xmog_localenv *env=NULL) |
| Returns the classname. | |
| xmog_java_class::XMOG_INTERCEPTOR | getInterceptor () const |
Returns an installed interceptor or NULL if there is none. | |
| bool | has_peer_unmarshaller () const |
Returns true if the class has at least one peer unmarshaller registered. | |
| void | has_peer_unmarshaller (bool bHPU) |
| Sets the flag that indicates that the class has at least one peer unmarshaller registered for it. | |
| void | operator delete (void *) |
| An overloaded operator delete to support the safe cleanup of instances independent of whether they are allcoated on the heap or not. | |
| void * | operator new (size_t) |
| An overloaded operator new to support the automatic detection of whether or not the object is heap-allocated. | |
| void | remove_field (xmog_java_field *_field) |
| Removes a field from the list of field that this instance is aware of. | |
| void | remove_method (xmog_java_method *_method) |
| Removes a method from the list of methods that this instance is aware of. | |
| void | setInterceptor (XMOG_INTERCEPTOR icp) |
| Sets an API interceptor for the Java type represented by this instance. | |
| void | throw_ (jthrowable throwable, xmog_flags flags, int error_code=0, xmog_localenv *env=NULL) |
| Throws an instance of the proxy type represented by this instance. | |
| xmog_java_class (jclass _local, xmog_flags _flags, const char *classNameUTF=NULL, xmog_localenv *env=NULL) | |
| The constructor that creates an instance based on an existing JNI reference. | |
| xmog_java_class (const char *classNameUTF, jbyte *bytes, jint length, jbyte *stubBytes, jint stubLength, jbyte *skelBytes, jint skelLength, bool bDelayInit=false, XMOG_FACTORY_METHOD factoryMethod=NULL_FACTORY_METHOD, XMOG_THROW_METHOD throwMethod=NULL_THROW_METHOD, XMOG_TOJAVA_METHOD toJavaMethod=NULL_TOJAVA_METHOD, XMOG_FROMJAVA_METHOD fromJavaMethod=NULL_FROMJAVA_METHOD, xmog_localenv *env=NULL) | |
| The constructor that creates an instance based on class bytes. | |
| xmog_java_class (const char *classNameUTF, jbyte *bytes, jint length, bool bDelayInit=false, XMOG_FACTORY_METHOD factoryMethod=NULL_FACTORY_METHOD, XMOG_THROW_METHOD throwMethod=NULL_THROW_METHOD, XMOG_TOJAVA_METHOD toJavaMethod=NULL_TOJAVA_METHOD, XMOG_FROMJAVA_METHOD fromJavaMethod=NULL_FROMJAVA_METHOD, xmog_localenv *env=NULL) | |
| The constructor that creates an instance based on class bytes. | |
| xmog_java_class (const char *classNameUTF, const char *version, const char *config, bool bDelayInit=false, XMOG_FACTORY_METHOD factoryMethod=NULL_FACTORY_METHOD, XMOG_THROW_METHOD throwMethod=NULL_THROW_METHOD, XMOG_TOJAVA_METHOD toJavaMethod=NULL_TOJAVA_METHOD, XMOG_FROMJAVA_METHOD fromJavaMethod=NULL_FROMJAVA_METHOD, xmog_localenv *env=NULL) | |
| The constructor that creates an instance based on the classname and a named configuration. | |
| xmog_java_class (const char *classNameUTF, bool bDelayInit=false, XMOG_FACTORY_METHOD factoryMethod=NULL_FACTORY_METHOD, XMOG_THROW_METHOD throwMethod=NULL_THROW_METHOD, XMOG_TOJAVA_METHOD toJavaMethod=NULL_TOJAVA_METHOD, XMOG_FROMJAVA_METHOD fromJavaMethod=NULL_FROMJAVA_METHOD, xmog_localenv *env=NULL) | |
| The constructor that creates an instance based on the classname. | |
| xmog_java_class () | |
| The default constructor. | |
Static Public Member Functions | |
| static void | add_class (xmog_java_class *clazz) |
| Adds a proxy class to the proper list of classes. | |
| static void | addDirectoryJarFiles (const char *dirnameUTF, bool preferred=false, xmog_localenv *env=NULL) |
| Adds all jarfiles in the specified directory to the classpath used by the custom classloader. | |
| static void | addInMemoryResourceRoot (const jbyte *bytes, size_t len, bool preferred=false, xmog_localenv *env=NULL) |
| Adds the embedded classes to the classpath used by the custom classloader. | |
| static void | addLocalResourceRoot (const char *filenameUTF, bool preferred=false, xmog_localenv *env=NULL) |
| Adds a file to the classpath used by the custom classloader. | |
| static void | bootstrap (xmog_localenv *env=NULL) |
| Injects the custom classloader types into the JVM. | |
| static jint | calculate_hashcode (const char *_classNameUTF) |
| A utility method for calculating the hashcode of a classname. | |
| static jbyte | calculateMaximumSupportedClassVersion () |
| Calculates the maximum supported class version. | |
| static bool | call_bool_indirect (xmog_java_method *method, jobject instance, xmog_java_values *values, xmog_localenv *env) |
| Calls a Java method indirectly. | |
| static jboolean | call_boolean_indirect (xmog_java_method *method, jobject instance, xmog_java_values *values, xmog_localenv *env) |
| Calls a Java method indirectly. | |
| static jbyte | call_byte_indirect (xmog_java_method *method, jobject instance, xmog_java_values *values, xmog_localenv *env) |
| Calls a Java method indirectly. | |
| static jchar | call_char_indirect (xmog_java_method *method, jobject instance, xmog_java_values *values, xmog_localenv *env) |
| Calls a Java method indirectly. | |
| static jdouble | call_double_indirect (xmog_java_method *method, jobject instance, xmog_java_values *values, xmog_localenv *env) |
| Calls a Java method indirectly. | |
| static jfloat | call_float_indirect (xmog_java_method *method, jobject instance, xmog_java_values *values, xmog_localenv *env) |
| Calls a Java method indirectly. | |
| static jint | call_int_indirect (xmog_java_method *method, jobject instance, xmog_java_values *values, xmog_localenv *env) |
| Calls a Java method indirectly. | |
| static jlong | call_long_indirect (xmog_java_method *method, jobject instance, xmog_java_values *values, xmog_localenv *env) |
| Calls a Java method indirectly. | |
| static jobject | call_object_indirect (xmog_java_method *method, jobject instance, xmog_java_values *values, xmog_localenv *env) |
| Calls a Java method indirectly. | |
| static jshort | call_short_indirect (xmog_java_method *method, jobject instance, xmog_java_values *values, xmog_localenv *env) |
| Calls a Java method indirectly. | |
| static void | call_void_indirect (xmog_java_method *method, jobject instance, xmog_java_values *values, xmog_localenv *env) |
| Calls a Java method indirectly. | |
| static xmog_java_class * | get_best_throwable_for (xmog_base *throwable, bool bRemote, xmog_localenv *env=NULL) |
| Returns the best matching xmog_java_class instance for the given throwable and that has a non-NULL exception factory method. | |
| static jobject | get_bootstrap_classloader (xmog_localenv *env=NULL) |
| Returns the classloader used by the Codemesh framework. This method only works for 1.2 or later JVMs because it relies on the post 1.1 classloader specification. | |
| static xmog_java_class * | get_class_named (const char *classNameUTF) |
| Returns the xmog_java_class instance for the given name that has a non-NULL instance factory method. | |
| static xmog_java_class * | get_classes () |
| Returns the first class in the list of regular types. | |
| static xmog_java_class * | get_exact_throwable_for (const char *classNameUTF) |
| Returns the exact xmog_java_class instance for the given name that has a non-NULL exception factory method. | |
| static xmog_java_class * | get_throwables () |
| Returns the first class in the list of throwable types. | |
| static xmog_java_method & | getClass_method () |
| Returns a reference to a method wrapping around getClass(). | |
| static char * | getClassClassName (jclass clazz, xmog_localenv *env=NULL) |
| Returns the classname of a given class instance. | |
| static char * | getClassName (jobject inst, xmog_localenv *env=NULL) |
| Returns the classname of the given instance. | |
| static int | getInterceptorCount () |
| Returns the total number of interceptors registered with all types. | |
| static void | initThread (xmog_localenv *env=NULL) |
| Performs per-thread initialization in relation with the custom classloader. | |
| static xmog_java_method & | isInstance_method () |
| Returns a reference to a method wrapping around isInstance(). | |
| static void | remove_class (xmog_java_class *clazz) |
| Removes a proxy class from the proper list of classes. | |
| static void | setSecurityManager (xmog_java_method &mSSM, const xmog_java_ref &sm, xmog_localenv *env) |
| Returns the method used to set the security manager. | |
Static Public Attributes | |
| static XMOG_FACTORY_METHOD | NULL_FACTORY_METHOD |
| An instance that can be used in places where no instance factory is required. | |
| static XMOG_FROMJAVA_METHOD | NULL_FROMJAVA_METHOD |
| An instance that can be used in places where no from-Java specialization is required. | |
| static XMOG_THROW_METHOD | NULL_THROW_METHOD |
| An instance that can be used in places where no exception factory is required. | |
| static XMOG_TOJAVA_METHOD | NULL_TOJAVA_METHOD |
| An instance that can be used in places where no to-Java specialization is required. | |
This class provides basic proxy services for Java types. It has a number of constructors that allow the instantiation of a wrapper object based on a classname or on an existing JNI reference. It also utility methods that bootstrap a classloader that will be used by the native application and allow the efficient lookup of a class wrapper instance based on its classname.
|
|
A typedef for the method that can be used to return a heap-allocated instance of a proxy type based on a JNI reference. Every generated proxy class maintains a pointer to a function of this type that can be used as a factory method for instances of that proxy type. This method can then be used to dynamically create a proxy instance solely based on the type of the Java object (or additional factors).
|
|
|
A typedef for the method that can be used to perform custom object initialization for a proxy type that is being created for an existing Java object. When a Java method returns a reference as a result of its invocation, we usually simply wrap the reference in the proxy type for the declared return type. This is not always sufficient. For example: a user might wish to derive custom data types from a proxy type on the C++ side. These data types may contain data fields that should be persisted to the Java side and that should be read from the Java side when such a persisted instance is given back as the result of a method call. There are two issues to solve. The first involves creating an instance of the proper type and the second involves initializing that instance with the correct data. |
|
|
A typedef for a method that can be registered to handle or augment the processing of proxy API calls.
|
|
|
A typedef for the method that can be used to perform custom object conversion for a native type that is being transformed into a Java object. When a Java method returns a reference as a result of its invocation, we usually simply wrap the reference in the proxy type for the declared return type. This is not always sufficient. For example: a user might wish to derive custom data types from a proxy type on the C++ side. These data types may contain data fields that should be persisted to the Java side and that should be retrievable from the Java side when such a persisted instance is given back as the result of another method call. This method is responsible for instantiating a proper Java peer object and for persisting the native instance in that Java object. The act of persisting the native object needs to include both the object's state and enough type information to allow the framework to instantiate the correct native type when the object is read back from Java. It is assumed that the native object is a subtype of a proxy type, thereby allowing its use with the generated typesystem. |
|
|
A value used to signal further interceptor processing requirements.
|
|
|
A value used to signal the interceptor type.
|
|
|
A value used to signal the interceptor call reason.
|
|
||||||||||||||||||||||||||||||||
|
The constructor that creates an instance based on the classname. This constructor can be used to easily create a wrapper instance that is not associated with a named configuration (for example for a built-in Java framework type that is always available, no matter what the classpath is).
|
|
||||||||||||||||||||||||||||||||||||||||
|
The constructor that creates an instance based on the classname and a named configuration. This constructor can be used to easily create a wrapper instance that is associated with a named configuration (the named configuration would contain classpath information necessary to locate the type). The code generator will tpyically use this form of the constructor to associate a Java type with configuration information. Depending on the configuration mechanism you are using, this information might be used or not.
|
|
||||||||||||||||||||||||||||||||||||||||
|
The constructor that creates an instance based on class bytes. This constructor can be used to easily create a wrapper instance that injects a Java type defined in native code into the JVM.
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The constructor that creates an instance based on class bytes. This constructor can be used to easily create a wrapper instance that injects a Java type defined in native code into the JVM.
|
|
||||||||||||||||||||
|
The constructor that creates an instance based on an existing JNI reference. This constructor can be used to easily create a wrapper instance that wraps around a JNI reference to a class.
|
|
|
Adds a proxy class to the proper list of classes. Depending on the value of teh various factory methods, the class instance gets added to the list of types and possibly to the list of exception types.
|
|
|
Adds a field to the list of fields that this instance is aware of. This method does not perform any searches to prevent the insertion of duplicate entries. The developer is in charge of making sure that fields are not added more than once. Problems would arise if the same dynamically allocated instance were added more than once because the corresponding remove method will call delete() on the instance and any removal after the first one would cause memory corruption.
|
|
|
Adds a method to the list of methods that this instance is aware of. This method does not perform any searches to prevent the insertion of duplicate entries. The developer is in charge of making sure that fields are not added more than once. Problems would arise if the same dynamically allocated instance were added more than once because the corresponding remove method will call delete() on the instance and any removal after the first one would cause memory corruption.
|
|
||||||||||||||||
|
Adds all jarfiles in the specified directory to the classpath used by the custom classloader. This method only works for 1.2 or later JVMs because it relies on the post 1.1 classloader specification.
|
|
||||||||||||||||||||
|
Adds the embedded classes to the classpath used by the custom classloader. This method only works for 1.2 or later JVMs because it relies on the post 1.1 classloader specification.
|
|
||||||||||||||||
|
Adds a file to the classpath used by the custom classloader. This method only works for 1.2 or later JVMs because it relies on the post 1.1 classloader specification.
|
|
|
Injects the custom classloader types into the JVM. This method only works for 1.2 or later JVMs because it relies on the post 1.1 classloader specification.
|
|
|
A utility method for calculating the hashcode of a classname. This method replaces periods in the name with slashes when calculating the hashcode. This removes a potential source of hashcode mismatches when internal and external classname representations are mixed up.
|
|
||||||||||||||||||||
|
Calls a Java method indirectly.
|
|
||||||||||||||||||||
|
Calls a Java method indirectly.
|
|
||||||||||||||||||||
|
Calls a Java method indirectly.
|
|
||||||||||||||||||||
|
Calls a Java method indirectly.
|
|
||||||||||||||||||||
|
Calls a Java method indirectly.
|
|
||||||||||||||||||||
|
Calls a Java method indirectly.
|
|
||||||||||||||||||||
|
Calls a Java method indirectly.
|
|
||||||||||||||||||||
|
Calls a Java method indirectly.
|
|
||||||||||||||||||||
|
Calls a Java method indirectly.
|
|
||||||||||||||||||||
|
Calls a Java method indirectly.
|
|
||||||||||||||||||||
|
Calls a Java method indirectly.
|
|
||||||||||||||||
|
Returns an object reference or This method represents the heart of the casting mechanism in the framework. It takes one proxy instance as input and returns a proper reference if the original instance was type compatible.
|
|
||||||||||||||||
|
Returns the best matching xmog_java_class instance for the given throwable and that has a non-NULL exception factory method. This method is used to find the best available proxy type for a given exception. We don't always have the exact exception type that was thrown in Java available as a C++ proxy type. Because of that, we want to throw the best matching exception, which means that we search for the most derived type in the exception type's inheritance hierarchy.
|
|
|
Returns the classloader used by the Codemesh framework. This method only works for 1.2 or later JVMs because it relies on the post 1.1 classloader specification.
|
|
|
Returns the xmog_java_class instance for the given name that has a non-NULL instance factory method. This method is used to find the proxy class for a Java class of a given name. Such a lookup is useful for scenarios where all we have is a Java classname and what we need is the proxy instance that provides
|
|
|
Returns the exact xmog_java_class instance for the given name that has a non-NULL exception factory method. This method is used to find the exact exception type by name and is useful because we can easily compare based on the hashvalue.
|
|
|