Home > Archive > Java Help > August 2006 > How to invoke assignment operator in a native method?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to invoke assignment operator in a native method?
|
|
| HappyHippy 2006-08-30, 7:02 pm |
| Hi,
Could you please help me to figure out how to invoke assignment operator
in a native method (C/C++ side)?
For StringBuffer "append" method I am doing the following:
....
jmethodID methodId = env->GetMethodID(objClass, "append",
"(Ljava/lang/String;)Ljava/lang/StringBuffer;");
....
Can I do something like this for Integer's assignment operator?
Something like:
jmethodID methodId = env->GetMethodID(objClass, "=",
"(Ljava/lang/Integer;)Ljava/lang/Integer;");
And then just invoke it via: env->CallObjectMethod(..., methodId,....)
Thank you!
| |
| Gordon Beaton 2006-08-30, 7:02 pm |
| On Wed, 30 Aug 2006 13:44:41 -0400, HappyHippy wrote:
> Can I do something like this for Integer's assignment operator?
> Something like:
>
> jmethodID methodId = env->GetMethodID(objClass, "=",
> "(Ljava/lang/Integer;)Ljava/lang/Integer;");
Please explain exactly what it is you're trying to achieve, not how
you hope to achieve it.
To see what methods the Integer class has, use javap -s. The only way
to assign a value to an Integer is to specify the value when you
invoke the constructor.
If your class has an Integer field and you want to assign an
(existing) Integer *object* to it, use SetObjectField().
Please don't multipost. I've *crossposted* this reply and set
followups to c.l.j.programmer.
/gordon
--
[ don't email me support questions or followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
|
|
|
|
|