Hi Rony,
what I did to solve a similar problem:
I am using the service
/singletons/com.sun.star.reflection.theTypeDescriptionManager
instantiated by using interface: com.sun.star.uno.XComponentContext, method:
getValueByName
From that I can query the interface: XTypeDescriptionEnumerationAccess
with method createTypeDescriptionEnumeration I can get a list of type
descriptions (using the parameter types of that method I can limit that to
interfaces) and can get all interfaces of a module
using method nextTypeDescription I get an interface XTypeDescription with
methods getName and getTypeClass
Having the name of the interface I can use interface:
com.sun.star.reflection.XInterfaceTypeDescription
with method getMembers I get a sequences of XInterfaceMemberTypeDescriptions
with method getMemberName i can get the name of the property/attribute or
method
Having the interface name and the method name I use interface:
com.sun.star.reflection.XIdlReflection method: forName to get an interface
XIdlClass and using getMethod I get a XIdlMethod interface for the rest
(getParameters, getReturnType. etc.)
Hope that helps,
Arnulf
Am Mittwoch, 3. August 2005 15:11 schrieb Rony G. Flatscher:
> Hi Jürgen,
>
> >> it seems that the official way of getting all the interfaces there
> >> are is only available via an object which possesses the XTypeProvider
> >> interface. Does this mean that one could not infer from an UNO class
> >> object which interfaces it supplies, but would really need an
> >> instance of such a class?
> >
> > that is right, most of the objects you get over the API are
> > implemented in C++ and you got an proxy object in Java only. So you
> > don't know the class object before you have a real instance of the
> > object. The objects are created dynamically.
>
> But if I have an instance of XIdlClass, wouldn't reflection be able to
> arrive at the corresponding class and inspect (reflect | introspect) it
> such, that the UNOIDL defined interfaces and services could be
> determined by it (thought, that the deprecated method "getInterfaces()"
> of XIdlClass did do that) ?
>
> E.g. if using
>
> XIdlClass xidl=XIdlReflection.forName("com.sun.star.frame.Desktop");
>
> then the class to inspect is (should be) known?
>
> The same would be true with using an object to get at its type (class)
> as well:
>
> XIdlClass xidl=XIdlReflection.getType(someObject);
>
> XIdlClass.getName() would in both cases return the fully qualified class
> name as a string, hence XIdlClass *should* know at least the name of the
> reflected class and hence be able to inspect it and come up with these
> important infos.
>
> How "dangerous" would it be to still use the deprecated method
> "getInterfaces()", really?
>
> Maybe I should ask: what would be the real difference between this
> deprecated XIdlClass method and using the XTypeProvider interface for an
> object, if looking at the resulting sequence of Interface types?
>
> ---
>
> The motivation: I would like to analyze a UNO class via Java without the
> mandatory need to instantiate such a class upfront. At the moment I can
> only come by using a lazy inspection scheme, but that has the
> consequence that it is not possible to present all of the methods and
> fields of a given class in all cases, because the methods and fields of
> interfaces/services cannot be figured out at runtime as long as such a
> class did not get instantiated. (This seems to restrict the
> reflectability quite considerably.)
>
> ---
>
> I would like to thank you, Daniel and -mjayant for your kind help!
>
> Regards,
>
> ---rony
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]