Skip navigation.
 
mlRe: cocoa java bridge: converting nsarray to java array
FROM : Matthew
DATE : Sun Nov 21 21:51:33 2004

The encapsulation isn't being broken. I misspoke, but here's what I was
thinking:

Well, suppose that if you have a java class with a ton of methods that
are all used frequently...further suppose that there's only one of
those methods that you'd be writing a wrapper for to extract the
contents of the NSArray (assume all of the others accept strings, ints,
or whatever else passes 'easily'.

So you have a single Java class with plenty of methods fine to use 'as
is' and then this auxiliary wrapper for one of its methods, so the Java
class can't take data form the Java bridge 'as is' without that extra
wrapper. in other words, it seems to me that the Java bridge should
pass data from the Objective C side and there should not have to be any
extra wrappers and data conversion on the Java side in order to accept
it. Maybe this isn't breaking encapsulation strictly speaking, but it
seems like there's something awkward going on since the Java class
needs a helper method outside itself as it was originally defined.

I'm having a hard time understanding why it's unreasonable to pass an
NSArray of NSString to a Java method and have it accept it 'as is', as
an array of String[]. But again, I've done very little with the Java
bridge and this might seem completely reasonable to those of you who
have used it frequently.

Is this then a matter of Apple just not getting around to implementing
this functionality, am I expecting something unreasonable, or is this a
design decision that purposefully needed to be this way? Seems to me
that if Java can send things to the Obj C side like an NSArray, it
should be a mutual 2 way street?

On Nov 21, 2004, at 3:32 PM, j o a r wrote:

> In what way is encapsulation of the Java class broken?
>
> (Please don't cross post!)
>
> j o a r
>
> On 2004-11-21, at 21.05, Matthew wrote:
>

>> Ok, I think that will work for the time being. Thanks for the
>> suggestion. It still seems kludgy, however, that in order to make
>> this happen, you have to violate the encapsulation of the Java class
>> to get the NSArray to 'pass through' the way you'd like.  Seems like
>> there would be a cleaner way of making this happen. Oh well.

>

Related mailsAuthorDate
mlcocoa java bridge: converting nsarray to java array Matthew Nov 20, 23:13
mlRe: cocoa java bridge: converting nsarray to java array Marcel Weiher Nov 21, 11:57
mlRe: cocoa java bridge: converting nsarray to java array Matthew Nov 21, 15:04
mlRe: cocoa java bridge: converting nsarray to java array Marcel Weiher Nov 21, 19:09
mlRe: cocoa java bridge: converting nsarray to java array Matthew Nov 21, 21:05
mlRe: cocoa java bridge: converting nsarray to java array j o a r Nov 21, 21:32
mlRe: cocoa java bridge: converting nsarray to java array Matthew Nov 21, 21:51
mlRe: cocoa java bridge: converting nsarray to java array j o a r Nov 21, 22:08
mlRe: cocoa java bridge: converting nsarray to java array Matthew Nov 21, 22:23
mlRe: cocoa java bridge: converting nsarray to java array M. Uli Kusterer Nov 23, 22:44