FACT++  1.0
JNIEXPORT void JNICALL Java_dim_ObjectDescriptor_copyIntoObject ( JNIEnv *  env,
jclass  nativeClass,
jlong  nativeDataAddress,
jobject  theObject,
jlong  desc 
)

Definition at line 2548 of file dim_jni.c.

References a_boolean, objectDescriptorEntry_struct::array, objectDescriptorEntry_struct::arrayOffset, c_boolean, DBGe, dim_Dbg_DESCRIPTORS, objectDescriptor_struct::entries, objectDescriptor_struct::entry, f_boolean, f_byte, f_char, f_double, f_float, f_int, f_long, f_short, objectDescriptorEntry_struct::fieldID, i, Java_dim_ObjectDescriptor_copyFromObject(), objectDescriptorEntry_struct::length, objectDescriptor_struct::objectClass, objectDescriptorEntry_struct::offset, and objectDescriptorEntry_struct::type.

Referenced by Java_dim_ObjectDescriptor_deleteObjectDescriptor().

2549 {
2550  int i;
2552 
2553  objectDescriptor_type* descriptor = (objectDescriptor_type*) desc;
2554  jclass objectClass = descriptor->objectClass;
2555 
2556  DBGe(dim_Dbg_DESCRIPTORS) printf("DimJNI: Native.copyIntoObject %08lx\n", (dim_long)desc);
2557 
2558  if(nativeClass){}
2559  // test if object can be cast to object class
2560  if((*env)->IsInstanceOf(env, theObject, objectClass) != JNI_TRUE)
2561  {
2562  // throw exception
2563  jclass exceptionClass = (*env)->FindClass(env, "java/lang/IllegalArgumentException");
2564  (*env)->ThrowNew(env, exceptionClass, " (Sorry...)");
2565  return;
2566  }
2567 
2568  // loop over descriptor entries
2569  entry = descriptor->entry;
2570  for (i=0; i<descriptor->entries; i++)
2571  {
2572  switch (entry->type)
2573  {
2574  case f_boolean:
2575  (*env)->SetBooleanField(env, theObject, entry->fieldID, *(jboolean*) (nativeDataAddress+entry->offset));
2576  break;
2577  case f_byte:
2578  (*env)->SetByteField( env, theObject, entry->fieldID, *(jbyte*) (nativeDataAddress+entry->offset));
2579  break;
2580  case f_char:
2581  (*env)->SetCharField( env, theObject, entry->fieldID, *(jchar*) (nativeDataAddress+entry->offset));
2582  break;
2583  case f_short:
2584  (*env)->SetShortField( env, theObject, entry->fieldID, *(jshort*) (nativeDataAddress+entry->offset));
2585  break;
2586  case f_int:
2587  (*env)->SetIntField( env, theObject, entry->fieldID, *(jint*) (nativeDataAddress+entry->offset));
2588  break;
2589  case f_long:
2590  (*env)->SetLongField( env, theObject, entry->fieldID, *(jlong*) (nativeDataAddress+entry->offset));
2591  break;
2592  case f_float:
2593  (*env)->SetFloatField( env, theObject, entry->fieldID, *(jfloat*) (nativeDataAddress+entry->offset));
2594  break;
2595  case f_double:
2596  (*env)->SetDoubleField( env, theObject, entry->fieldID, *(jdouble*) (nativeDataAddress+entry->offset));
2597  break;
2598  case a_boolean:
2599  (*env)->SetBooleanArrayRegion(env, entry->array, entry->arrayOffset, entry->length, (void*) (nativeDataAddress+entry->offset));
2600  break;
2601  case c_boolean:
2602  (*env)->SetBooleanArrayRegion(env, entry->array, entry->arrayOffset, entry->length, (void*) (nativeDataAddress+entry->offset));
2603  //TODO :: complete this list, including recursive call to this function for objects
2604  break;
2605  default:
2606  break;
2607  }
2608  //TODO :: ?? if ((*env)->ExceptionOccurred(env)) (*env)->ExceptionDescribe(env); // clear any possible exception, if we do not do this, all further methods will fail!!
2609  entry++;
2610  }
2611  return;
2612 }
#define dim_Dbg_DESCRIPTORS
Definition: dim_jni.h:60
int i
Definition: db_dim_client.c:21
long dim_long
Definition: dim_common.h:57
#define DBGe(test)
Definition: dim_jni.c:64
if(extraDns) new Dns
objectDescriptorEntry_type * entry
Definition: dim_jni.c:2372

+ Here is the call graph for this function:

+ Here is the caller graph for this function: