Hi there,

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?

    E:\rony\dev\bsf\src\bin>rexxtry
    REXX-ooRexx_3.2.0(MT) 6.02 16 Jun 2008
      rexxtry.rex lets you interactively try REXX statements.
        Each string is executed when you hit Enter.
        Enter 'call tell' for a description of the features.
      Go on - try a few...            Enter 'exit' to end.
    call uno.cls
      ........................................... rexxtry.rex on WindowsNT
    a=uno.createDesktop()  /* creates and returns a desktop service object */
      ........................................... rexxtry.rex on WindowsNT
    b=a~XDesktop           /* queries the "com.sun.star.frame.XDestkop" 
interface */
      ........................................... rexxtry.rex on WindowsNT
    c=b~XPropertySet       /* queries the "com.sun.star.beans.XPropertySet" 
interface */
      ........................................... rexxtry.rex on WindowsNT
    say a~toString         /* ask the proxy for its string representation */
    
[Proxy:9938272,4c801ac;msci[0];71a4c62fd6a4ea18dca702d3c4a726d,Type[com.sun.star.uno.XInterface]]
      ........................................... rexxtry.rex on WindowsNT
    say b~toString         /* ask the proxy for its string representation */
    
[Proxy:32134769,4c801ac;msci[0];71a4c62fd6a4ea18dca702d3c4a726d,Type[com.sun.star.frame.XDesktop]]
      ........................................... rexxtry.rex on WindowsNT
    say c~toString         /* ask the proxy for its string representation */
    
[Proxy:30495813,4c801ac;msci[0];71a4c62fd6a4ea18dca702d3c4a726d,Type[com.sun.star.beans.XPropertySet]]
      ........................................... rexxtry.rex on WindowsNT
    say a~uno.getTypeName b~uno.getTypeName c~uno.getTypeName  /* get the IDL 
type name via reflection */
    UNO_SERVICE UNO_SERVICE UNO_SERVICE
      ........................................... rexxtry.rex on WindowsNT
    say uno.areSame(a,b) uno.areSame(b,c) uno.areSame(a,c)     /* test whether 
all three are the same object */
    1 1 1
      ........................................... rexxtry.rex on WindowsNT
      


TIA for any pointers/hints,

---rony



Reply via email to