Hi,

I have one function (in a library I can't change the code) which takes a key and returns a Object. This code is written in java. I am calling this function from cpp code. I am accepting the result as jobject.

  1. Added key as "key1" & value as boolean true by calling a function. it saves in a map after converting in into java BooleanObject.
  2. When I get it back I get it back as Object. I want to compare it with true now. How can I do that?

    Thanks in advance.

Recommended Answers

All 2 Replies

I thought this question was how to handle a Java Object (that happens to be a Boolean) in cpp code?

If it's a Java question then you need to cast the Object to Boolean (maybe checking first that it is an instanceof Boolean). Java will handle conversion between a Boolean object and a boolean primitive (eg true) automatically - it's called unboxing

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.