Hi Stephan,

>> while poking around a little bit I was wondering, how one could get at
>> the "Type[...]" information via Java that the Java proxy object reveals,
>> if asking it to render to a string.
>>
>> E.g. in the following (interactive) session Java is used as the bridge
>> for the scripting language ooRexx; first a Desktop service object is
>> created and assigned to a variable "a", then its
>> "com.sun.star.frame.XDesktop" interface is assigned to variabel "b" and
>> from it the "com.sun.star.beans.XPropertySet" interface is assigned to
>> variable "c". Sending the "toString" message to all three proxy objects
>> displays them allowing to distinguish which interface type they
>> represent.
>>
>> In the example session below (please watch out for line-wraps) that
>> interface type is the last comma separated token in the form of
>> "Type[...interface_name...]".
>>
>> Now the question: how can one get at exactly that piece of information
>> via Java at runtime?
>
> You can't, easily.  (Maybe you can via reflection).  As of DEV300m31,
> every Java proxy object must implement interface
> com.sun.star.lib.uno.Proxy (see
> jurt/com/sun/star/lib/uno/Proxy.java:1.4), and the two cases that do
> are defined in
> jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java:1.8
> (for the remote URP bridge), storing the relevant data as "private
> final Type type;", and in
> bridges/source/jni_uno/java/com/sun/star/bridges/jni_uno/JNI_proxy.java
> (for the in-process JNI bridge), storing the relevant data as
> "protected Type m_type;".
Thank you very much for these interesting pointers!

Just another question: how about if I were to run the "toString()"
method against a service object proxy and parse the type information.
This way it's the proxy's toString()-method problem to figure out and
supply the interface type. (Performance in the context of the thought
for use-cases is not an issue at all, given those warped PCs people have
come to use today.)

> Besides, that a proxy handles only a single interface (plus parent
> interfaces) of a UNO object is, of course, an implementation detail
> that can always change.
Sure.

Actually, what I am after is to determine at runtime whether the service
object in hand got a queryInterface for a specific interface carried out
already or not. Currently, it would be important to find out whether the
"com.sun.star.beans.XPropertySet" interface was queried already (i.e.
whether its methods would be available already, or whether one needs to
query that interface). However, this may be interesting in other
contexts, where a service object is returned and it may be interesting
to know which interfaces got queried for already.

---rony








---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to