From 0d8719b0ff9aacb7cdd8a238b8060540d4d00eff Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 17 Apr 2013 15:10:06 +0200 Subject: 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 Tested-by: Fridrich Strba --- .../DevelopersGuide/OfficeDev/ContextMenuInterceptor.java | 4 ++-- odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'odk/examples') 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 createRemoteInstance(Class 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 createRemoteInstanceWithArguments(Class aType, String sServiceSpecifier, Any[] lArguments) { - Object aResult = null; + T aResult = null; try { aResult = UnoRuntime.queryInterface( -- cgit