diff options
author | Noel Grandin <noel@peralex.com> | 2013-04-17 15:10:06 +0200 |
---|---|---|
committer | Fridrich Strba <fridrich@documentfoundation.org> | 2013-04-19 07:52:51 +0000 |
commit | 0d8719b0ff9aacb7cdd8a238b8060540d4d00eff (patch) | |
tree | d18b78dac7c69da9dfe20c22b0c0c90364cf1278 /odk | |
parent | 8d87758d65e4a03271f76e354dfc84c1fcd5fe21 (diff) |
Java cleanup, use generics in calls to UnoRuntime#queryInterface
A handful of places wrap the call to queryInterface. With a little
generics love, we can reduce the casting required.
Change-Id: I9efca2afb1b23fad2359af24e1c273aea96e45fe
Reviewed-on: https://gerrit.libreoffice.org/3433
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'odk')
-rw-r--r-- | odk/examples/DevelopersGuide/OfficeDev/ContextMenuInterceptor.java | 4 | ||||
-rw-r--r-- | odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/odk/examples/DevelopersGuide/OfficeDev/ContextMenuInterceptor.java b/odk/examples/DevelopersGuide/OfficeDev/ContextMenuInterceptor.java index 67d0331b2c29..608ad199c065 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/ContextMenuInterceptor.java +++ b/odk/examples/DevelopersGuide/OfficeDev/ContextMenuInterceptor.java @@ -52,8 +52,8 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor { OfficeConnect aConnect = OfficeConnect.createConnection(); com.sun.star.frame.XDesktop xDesktop = - (com.sun.star.frame.XDesktop)aConnect.createRemoteInstance( - com.sun.star.frame.XDesktop.class,"com.sun.star.frame.Desktop"); + aConnect.createRemoteInstance( + com.sun.star.frame.XDesktop.class,"com.sun.star.frame.Desktop"); // create a new test document com.sun.star.frame.XComponentLoader xCompLoader = diff --git a/odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java b/odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java index 1efa20c4fc1b..47bf1bb74b04 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java +++ b/odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java @@ -107,9 +107,9 @@ public class OfficeConnect * @param sServiceSpecifier name of service which should be created * @return Description of the Returned Value */ - public Object createRemoteInstance(Class aType, String sServiceSpecifier) + public <T> T createRemoteInstance(Class<T> aType, String sServiceSpecifier) { - Object aResult = null; + T aResult = null; try { aResult = UnoRuntime.queryInterface( @@ -136,9 +136,9 @@ public class OfficeConnect * @param sServiceSpecifier Description of Parameter * @return Description of the Returned Value */ - public Object createRemoteInstanceWithArguments(Class aType, String sServiceSpecifier, Any[] lArguments) + public <T> T createRemoteInstanceWithArguments(Class<T> aType, String sServiceSpecifier, Any[] lArguments) { - Object aResult = null; + T aResult = null; try { aResult = UnoRuntime.queryInterface( |