summaryrefslogtreecommitdiff
path: root/libjava/java/io/natVMObjectStreamClass.cc
blob: 847b540f0be3f17e95d248275008167676dc3ae7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// natVMObjectStreamClass.cc - Native part of VMObjectStreamClass class.

/* Copyright (C) 2003  Free Software Foundation

   This VMObjectStreamClass is part of libgcj.

This software is copyrighted work licensed under the terms of the
Libgcj License.  Please consult the ObjectInputStream "LIBGCJ_LICENSE" for
details.  */

#include <gcj/cni.h>
#include <jvm.h>

#include <java/io/VMObjectStreamClass.h>
#include <java/lang/Class.h>
#include <java/lang/reflect/Field.h>

using namespace java::lang::reflect;

jboolean
java::io::VMObjectStreamClass::hasClassInitializer (jclass klass)
{
  if (klass->isPrimitive())
    return false;
  _Jv_Method *meth = _Jv_GetMethodLocal(klass, gcj::clinit_name,
					       gcj::void_signature);
  return (meth != NULL);
}

void
java::io::VMObjectStreamClass::setDoubleNative (Field *f, jobject obj, 
						jdouble val)
{
  f->setDouble (NULL, obj, val, false);
}

void 
java::io::VMObjectStreamClass::setFloatNative (Field *f, jobject obj, 
					       jfloat val)
{
  f->setFloat (NULL, obj, val, false);
}

void
java::io::VMObjectStreamClass::setLongNative (Field *f, jobject obj, jlong val)
{
  f->setLong (NULL, obj, val, false);
}

void
java::io::VMObjectStreamClass::setIntNative (Field *f, jobject obj, jint val)
{
  f->setInt (NULL, obj, val, false);
}

void
java::io::VMObjectStreamClass::setShortNative (Field *f, jobject obj, 
					       jshort val)
{
  f->setShort (NULL, obj, val, false);
}

void
java::io::VMObjectStreamClass::setCharNative (Field *f, jobject obj, jchar val)
{
  f->setChar (NULL, obj, val, false);
}

void
java::io::VMObjectStreamClass::setByteNative (Field *f, jobject obj, jbyte val)
{
  f->setByte (NULL, obj, val, false);
}

void
java::io::VMObjectStreamClass::setBooleanNative (Field *f, jobject obj,
						 jboolean val)
{
  f->setBoolean (NULL, obj, val, false);
}

void
java::io::VMObjectStreamClass::setObjectNative (Field *f, jobject obj, 
						jobject val)
{
  f->set (NULL, obj, val, f->getType(), false);
}