Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3566

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/66/3566/1

Java cleanup - remove unnecessary casts in the ODK code

Change-Id: I1ab8ad5182444fc3eebd2349135a0240ebbe0fd4
---
M odk/examples/DevelopersGuide/Forms/ControlLock.java
M odk/examples/DevelopersGuide/Forms/DataAwareness.java
M odk/examples/DevelopersGuide/Forms/DocumentBasedExample.java
M odk/examples/DevelopersGuide/Forms/DocumentHelper.java
M odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java
M odk/examples/DevelopersGuide/Forms/FLTools.java
M odk/examples/DevelopersGuide/Forms/FormLayer.java
M odk/examples/DevelopersGuide/Forms/GridFieldValidator.java
M odk/examples/DevelopersGuide/Forms/HsqlDatabase.java
M odk/examples/DevelopersGuide/Forms/KeyGenerator.java
M odk/examples/DevelopersGuide/Forms/RowSet.java
M odk/examples/DevelopersGuide/Forms/SalesFilter.java
M odk/examples/DevelopersGuide/Forms/SingleControlValidation.java
M odk/examples/DevelopersGuide/Forms/SpreadsheetDocument.java
M odk/examples/DevelopersGuide/Forms/SpreadsheetValueBinding.java
M odk/examples/DevelopersGuide/Forms/SpreadsheetView.java
M odk/examples/DevelopersGuide/Forms/UNO.java
M odk/examples/DevelopersGuide/Forms/ValueBinding.java
M odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java
M odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java
M odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java
M odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/JavaWindowPeerFake.java
M odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java
M odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java
M odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java
M odk/examples/DevelopersGuide/UCB/Helper.java
M odk/examples/DevelopersGuide/UCB/ResourceCreator.java
M odk/examples/java/Inspector/HideableTreeModel.java
M odk/examples/java/Inspector/InspectorAddon.java
M odk/examples/java/Inspector/InspectorPane.java
M odk/examples/java/Inspector/ProtocolHandlerAddon.java
M odk/examples/java/Inspector/SourceCodeGenerator.java
M odk/examples/java/Inspector/SwingDialogProvider.java
M odk/examples/java/Inspector/SwingTreeControlProvider.java
M odk/examples/java/Inspector/TDocSupplier.java
M odk/examples/java/Inspector/TestInspector.java
M odk/examples/java/Inspector/UnoNode.java
M odk/examples/java/Inspector/UnoPropertyNode.java
38 files changed, 200 insertions(+), 204 deletions(-)



diff --git a/odk/examples/DevelopersGuide/Forms/ControlLock.java 
b/odk/examples/DevelopersGuide/Forms/ControlLock.java
index a24a282..efce0c9 100644
--- a/odk/examples/DevelopersGuide/Forms/ControlLock.java
+++ b/odk/examples/DevelopersGuide/Forms/ControlLock.java
@@ -65,7 +65,7 @@
         if ( !super.shouldStepInto( xContainer ) )
             return false;   // don't try to be more clever than our base class
 
-        XForm xForm = (XForm)UnoRuntime.queryInterface( XForm.class, xContainer );
+        XForm xForm = UnoRuntime.queryInterface( XForm.class, xContainer );
         if ( ( null != xForm ) && ( m_nLevel > 1 ) )
             // don't step into sub forms - we only handle the form we were originally
             // applied to
@@ -169,7 +169,7 @@
         m_bLockingEnabled = bLock;
 
         // add or remove ourself as listener to get notified of cursor moves
-        XRowSet xRowSet = (XRowSet)UnoRuntime.queryInterface(
+        XRowSet xRowSet = UnoRuntime.queryInterface(
             XRowSet.class, m_xForm );
         if ( m_bLockingEnabled )
         {
diff --git a/odk/examples/DevelopersGuide/Forms/DataAwareness.java 
b/odk/examples/DevelopersGuide/Forms/DataAwareness.java
index a5aa106..70323e2 100644
--- a/odk/examples/DevelopersGuide/Forms/DataAwareness.java
+++ b/odk/examples/DevelopersGuide/Forms/DataAwareness.java
@@ -76,7 +76,7 @@
     public void handle( Object aFormComponent ) throws com.sun.star.uno.Exception
     {
         // the name of the child
-        XNamed xName = (XNamed)UnoRuntime.queryInterface( XNamed.class, aFormComponent );
+        XNamed xName = UnoRuntime.queryInterface( XNamed.class, aFormComponent );
 
         // if it's a form control model, check it's type
         XPropertySet xProps = UNO.queryPropertySet( aFormComponent );
@@ -183,7 +183,7 @@
     {
         String sObjectName;
 
-        XNamed xNameAcc = (XNamed)UnoRuntime.queryInterface( XNamed.class, xContainer );
+        XNamed xNameAcc = UnoRuntime.queryInterface( XNamed.class, xContainer );
         if ( null == xNameAcc )
             sObjectName = new String( "<unnamed>" );
         else
@@ -244,12 +244,12 @@
 
 
                         // get the columns of our master form
-                        XColumnsSupplier xSuppCols = (XColumnsSupplier)UnoRuntime.queryInterface(
+                        XColumnsSupplier xSuppCols = UnoRuntime.queryInterface(
                             XColumnsSupplier.class, xFormProps );
                         XNameAccess xCols = xSuppCols.getColumns();
 
                         // and update the date column with a NULL value
-                        XColumnUpdate xDateColumn = (XColumnUpdate)UnoRuntime.queryInterface(
+                        XColumnUpdate xDateColumn = UnoRuntime.queryInterface(
                             XColumnUpdate.class, xCols.getByName( "SALEDATE" ) );
                         xDateColumn.updateNull();
 
@@ -644,11 +644,11 @@
         // the container to insert columns into
         XIndexContainer xColumnContainer = UNO.queryIndexContainer( aGridModel );
         // the factory for creating column models
-        XGridColumnFactory xColumnFactory = (XGridColumnFactory)UnoRuntime.queryInterface(
+        XGridColumnFactory xColumnFactory = UnoRuntime.queryInterface(
             XGridColumnFactory.class, aGridModel );
 
         // (let) create the new col
-        XInterface xNewCol = (XInterface)xColumnFactory.createColumn( sColumnService );
+        XInterface xNewCol = xColumnFactory.createColumn( sColumnService );
         XPropertySet xColProps = UNO.queryPropertySet( xNewCol );
 
         // some props
@@ -913,7 +913,7 @@
         m_aSalesNameValidator.enableColumnWatch( false );
 
         // remove our own reset listener from the form
-        XNameAccess xMasterAsNames = (XNameAccess)UnoRuntime.queryInterface(
+        XNameAccess xMasterAsNames = UnoRuntime.queryInterface(
             XNameAccess.class, m_xMasterForm );
         XReset xFormReset = UNO.queryReset( xMasterAsNames.getByName( "Sales" ) );
         xFormReset.removeResetListener( this );
diff --git a/odk/examples/DevelopersGuide/Forms/DocumentBasedExample.java 
b/odk/examples/DevelopersGuide/Forms/DocumentBasedExample.java
index 2b10138..456e412 100644
--- a/odk/examples/DevelopersGuide/Forms/DocumentBasedExample.java
+++ b/odk/examples/DevelopersGuide/Forms/DocumentBasedExample.java
@@ -159,9 +159,8 @@
             // close our document
             if ( m_document != null )
             {
-                XCloseable closeDoc = (XCloseable)
-                    UnoRuntime.queryInterface( XCloseable.class,
-                                               m_document.getDocument() );
+                XCloseable closeDoc = UnoRuntime.queryInterface( XCloseable.class,
+                                           m_document.getDocument() );
                 if (closeDoc != null)
                     closeDoc.close( true );
                 else
diff --git a/odk/examples/DevelopersGuide/Forms/DocumentHelper.java 
b/odk/examples/DevelopersGuide/Forms/DocumentHelper.java
index 9132a9c..b10f52d 100644
--- a/odk/examples/DevelopersGuide/Forms/DocumentHelper.java
+++ b/odk/examples/DevelopersGuide/Forms/DocumentHelper.java
@@ -58,7 +58,7 @@
     public DocumentHelper( XComponentContext xContext, XComponent document )
     {
         m_remoteContext = xContext;
-        m_orb = (XMultiServiceFactory)UnoRuntime.queryInterface(
+        m_orb = UnoRuntime.queryInterface(
             XMultiServiceFactory.class, m_remoteContext.getServiceManager());
         m_documentComponent = document;
     }
@@ -66,7 +66,7 @@
     /* ------------------------------------------------------------------ */
     protected static XComponent implCreateBlankDocument( XComponentContext xCtx, String factoryURL 
) throws com.sun.star.uno.Exception
     {
-        XComponentLoader aLoader = (XComponentLoader)UnoRuntime.queryInterface(
+        XComponentLoader aLoader = UnoRuntime.queryInterface(
             XComponentLoader.class,
             xCtx.getServiceManager().createInstanceWithContext(
                 "com.sun.star.frame.Desktop", xCtx ));
@@ -100,7 +100,7 @@
     public DocumentViewHelper getCurrentView( )
     {
         // get the model interface for the document
-        XModel xDocModel = (XModel)UnoRuntime.queryInterface(XModel.class, m_documentComponent );
+        XModel xDocModel = UnoRuntime.queryInterface(XModel.class, m_documentComponent );
         // get the current controller for the document - as a controller is tied to a view,
         // this gives us the currently active view for the document.
         XController xController = xDocModel.getCurrentController();
@@ -137,7 +137,7 @@
         }
 
         // outta here
-        return (XIndexContainer)UnoRuntime.queryInterface( XIndexContainer.class, xNewForm );
+        return UnoRuntime.queryInterface( XIndexContainer.class, xNewForm );
     }
 
     /* ------------------------------------------------------------------ */
@@ -152,7 +152,7 @@
     public XIndexContainer createSubForm( Object aParentContainer, String sInitialName )
         throws com.sun.star.uno.Exception
     {
-        XIndexContainer xParentContainer = (XIndexContainer)UnoRuntime.queryInterface(
+        XIndexContainer xParentContainer = UnoRuntime.queryInterface(
             XIndexContainer.class, aParentContainer );
         return createSubForm( xParentContainer, sInitialName );
     }
@@ -169,8 +169,8 @@
     public XIndexContainer createSiblingForm( Object aForm, String sInitialName ) throws 
com.sun.star.uno.Exception
     {
         // get the parent
-        XChild xAsChild = (XChild)UnoRuntime.queryInterface( XChild.class, aForm );
-        XIndexContainer xContainer = (XIndexContainer)UnoRuntime.queryInterface(
+        XChild xAsChild = UnoRuntime.queryInterface( XChild.class, aForm );
+        XIndexContainer xContainer = UnoRuntime.queryInterface(
             XIndexContainer.class, xAsChild.getParent() );;
         // append a new form to this parent container
         return createSubForm( xContainer, sInitialName );
@@ -181,13 +181,13 @@
     */
     static public DocumentHelper getDocumentForComponent( Object aFormComponent, XComponentContext 
xCtx )
     {
-        XChild xChild = (XChild)UnoRuntime.queryInterface( XChild.class, aFormComponent );
+        XChild xChild = UnoRuntime.queryInterface( XChild.class, aFormComponent );
         XModel xModel = null;
         while ( ( null != xChild ) && ( null == xModel ) )
         {
             XInterface xParent = (XInterface)xChild.getParent();
-            xModel = (XModel)UnoRuntime.queryInterface( XModel.class, xParent );
-            xChild = (XChild)UnoRuntime.queryInterface( XChild.class, xParent );
+            xModel = UnoRuntime.queryInterface( XModel.class, xParent );
+            xChild = UnoRuntime.queryInterface( XChild.class, xParent );
         }
 
         return new DocumentHelper( xCtx, xModel );
@@ -212,7 +212,7 @@
     */
     public DocumentType classify( )
     {
-        XServiceInfo xSI = (XServiceInfo)UnoRuntime.queryInterface(
+        XServiceInfo xSI = UnoRuntime.queryInterface(
             XServiceInfo.class, m_documentComponent );
 
         if ( xSI.supportsService( "com.sun.star.text.TextDocument" ) )
@@ -234,11 +234,11 @@
      */
     protected XDrawPage getDrawPage( int index ) throws 
com.sun.star.lang.IndexOutOfBoundsException, com.sun.star.lang.WrappedTargetException
     {
-        XDrawPagesSupplier xSuppPages = (XDrawPagesSupplier)UnoRuntime.queryInterface(
+        XDrawPagesSupplier xSuppPages = UnoRuntime.queryInterface(
             XDrawPagesSupplier.class, getDocument() );
         XDrawPages xPages = xSuppPages.getDrawPages();
 
-        return (XDrawPage)UnoRuntime.queryInterface( XDrawPage.class, xPages.getByIndex( index ) );
+        return UnoRuntime.queryInterface( XDrawPage.class, xPages.getByIndex( index ) );
     }
 
     /* ------------------------------------------------------------------ */
@@ -249,18 +249,18 @@
         XDrawPage xReturn;
 
         // in case of a Writer document, this is rather easy: simply ask the XDrawPageSupplier
-        XDrawPageSupplier xSuppPage = (XDrawPageSupplier)UnoRuntime.queryInterface(
+        XDrawPageSupplier xSuppPage = UnoRuntime.queryInterface(
             XDrawPageSupplier.class, getDocument() );
         if ( null != xSuppPage )
             xReturn = xSuppPage.getDrawPage();
         else
         {   // the model itself is no draw page supplier - okay, it may be a Writer or Calc 
document
             // (or any other multi-page document)
-            XDrawPagesSupplier xSuppPages = (XDrawPagesSupplier)UnoRuntime.queryInterface(
+            XDrawPagesSupplier xSuppPages = UnoRuntime.queryInterface(
                 XDrawPagesSupplier.class, getDocument() );
             XDrawPages xPages = xSuppPages.getDrawPages();
 
-            xReturn = (XDrawPage)UnoRuntime.queryInterface( XDrawPage.class, xPages.getByIndex( 0 
) );
+            xReturn = UnoRuntime.queryInterface( XDrawPage.class, xPages.getByIndex( 0 ) );
 
             // Note that this is no really error-proof code: If the document model does not 
support the
             // XDrawPagesSupplier interface, or if the pages collection returned is empty, this 
will break.
@@ -274,7 +274,7 @@
     */
     protected XNameContainer getFormComponentTreeRoot( ) throws com.sun.star.uno.Exception
     {
-        XFormsSupplier xSuppForms = (XFormsSupplier)UnoRuntime.queryInterface(
+        XFormsSupplier xSuppForms = UnoRuntime.queryInterface(
             XFormsSupplier.class, getMainDrawPage( ) );
 
         XNameContainer xFormsCollection = null;
@@ -290,7 +290,7 @@
     */
     public XInterface createInstance( String serviceSpecifier ) throws com.sun.star.uno.Exception
     {
-        XMultiServiceFactory xORB = (XMultiServiceFactory)UnoRuntime.queryInterface( 
XMultiServiceFactory.class,
+        XMultiServiceFactory xORB = UnoRuntime.queryInterface( XMultiServiceFactory.class,
             m_documentComponent );
         return (XInterface)xORB.createInstance( serviceSpecifier );
     }
@@ -300,7 +300,7 @@
     */
     public XInterface createInstanceWithArguments( String serviceSpecifier, Object[] arguments ) 
throws com.sun.star.uno.Exception
     {
-        XMultiServiceFactory xORB = (XMultiServiceFactory)UnoRuntime.queryInterface( 
XMultiServiceFactory.class,
+        XMultiServiceFactory xORB = UnoRuntime.queryInterface( XMultiServiceFactory.class,
             m_documentComponent );
         return (XInterface) xORB.createInstanceWithArguments( serviceSpecifier, arguments );
     }
diff --git a/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java 
b/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java
index 7b16083..25308ea 100644
--- a/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java
+++ b/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java
@@ -90,12 +90,12 @@
         // go get the current view
         XController xController = (XController)get( XController.class );
         // go get the dispatch provider of it's frame
-        XDispatchProvider xProvider = (XDispatchProvider)UnoRuntime.queryInterface(
+        XDispatchProvider xProvider = UnoRuntime.queryInterface(
             XDispatchProvider.class, xController.getFrame() );
         if ( null != xProvider )
         {
             // need an URLTransformer
-            XURLTransformer xTransformer = (XURLTransformer)UnoRuntime.queryInterface(
+            XURLTransformer xTransformer = UnoRuntime.queryInterface(
                     XURLTransformer.class, m_orb.createInstance( 
"com.sun.star.util.URLTransformer" ) );
             xTransformer.parseStrict( aURL );
 
@@ -120,7 +120,7 @@
     public XFormController getFormController( Object _form )
     {
         XFormLayerAccess formLayer = (XFormLayerAccess)get( XFormLayerAccess.class );
-        return formLayer.getFormController( (XForm)UnoRuntime.queryInterface( XForm.class, _form ) 
);
+        return formLayer.getFormController( UnoRuntime.queryInterface( XForm.class, _form ) );
     }
 
     /* ------------------------------------------------------------------ */
@@ -141,14 +141,14 @@
     /* ------------------------------------------------------------------ */
     public XControl getFormControl( Object aModel ) throws com.sun.star.uno.Exception
     {
-        XControlModel xModel = (XControlModel)UnoRuntime.queryInterface( XControlModel.class, 
aModel );
+        XControlModel xModel = UnoRuntime.queryInterface( XControlModel.class, aModel );
         return getFormControl( xModel );
     }
 
     /* ------------------------------------------------------------------ */
     public Object getFormControl( Object aModel, Class aInterfaceClass ) throws 
com.sun.star.uno.Exception
     {
-        XControlModel xModel = (XControlModel)UnoRuntime.queryInterface( XControlModel.class, 
aModel );
+        XControlModel xModel = UnoRuntime.queryInterface( XControlModel.class, aModel );
         return UnoRuntime.queryInterface( aInterfaceClass, getFormControl( xModel ) );
     }
 
@@ -179,7 +179,7 @@
         XControl xControl = getFormControl( xModel );
 
         // the focus can be set to an XWindow only
-        XWindow xControlWindow = (XWindow)UnoRuntime.queryInterface( XWindow.class,
+        XWindow xControlWindow = UnoRuntime.queryInterface( XWindow.class,
             xControl );
 
         // grab the focus
@@ -202,7 +202,7 @@
             XPropertySet xControlProps = UNO.queryPropertySet( xForm.getByIndex( i ) );
             if ( FormComponentType.FIXEDTEXT != ((Short)xControlProps.getPropertyValue( "ClassId" 
)).shortValue() )
             {
-                XControlModel xControlModel = (XControlModel)UnoRuntime.queryInterface(
+                XControlModel xControlModel = UnoRuntime.queryInterface(
                     XControlModel.class, xControlProps );
                 // set the focus to this control
                 grabControlFocus( xControlModel );
diff --git a/odk/examples/DevelopersGuide/Forms/FLTools.java 
b/odk/examples/DevelopersGuide/Forms/FLTools.java
index 3f87e77..1438166 100644
--- a/odk/examples/DevelopersGuide/Forms/FLTools.java
+++ b/odk/examples/DevelopersGuide/Forms/FLTools.java
@@ -64,7 +64,7 @@
         URL[] aURL = new URL[] { new URL() };
         aURL[0].Complete = sURL;
         // need an URLTransformer
-        XURLTransformer xTransformer = (XURLTransformer)UnoRuntime.queryInterface(
+        XURLTransformer xTransformer = UnoRuntime.queryInterface(
             XURLTransformer.class,
             xCtx.getServiceManager().createInstanceWithContext(
                 "com.sun.star.util.URLTransformer", xCtx ) );
@@ -78,7 +78,7 @@
     */
     public static String getName( Object aFormComponent ) throws com.sun.star.uno.Exception
     {
-        XNamed xNamed = (XNamed)UnoRuntime.queryInterface( XNamed.class,
+        XNamed xNamed = UnoRuntime.queryInterface( XNamed.class,
             aFormComponent );
         String sName = "";
         if ( null != xNamed )
@@ -130,7 +130,7 @@
         int nIndex = -1;
 
         // norm the element
-        XInterface xElement = (XInterface)UnoRuntime.queryInterface(
+        XInterface xElement = UnoRuntime.queryInterface(
             XInterface.class, aElement );
 
         // get the container
@@ -142,7 +142,7 @@
             for ( int i = 0; i < nCount; ++i )
             {
                 // compare with the element
-                XInterface xCurrent = (XInterface)UnoRuntime.queryInterface(
+                XInterface xCurrent = UnoRuntime.queryInterface(
                     XInterface.class, xIndexCont.getByIndex( 0 ) );
                 if ( xCurrent.equals( xElement ) )
                 {   // found
@@ -161,7 +161,7 @@
     */
     static Object getParent( Object aComponent, Class aInterfaceClass )
     {
-        XChild xAsChild = (XChild)UnoRuntime.queryInterface( XChild.class, aComponent );
+        XChild xAsChild = UnoRuntime.queryInterface( XChild.class, aComponent );
 
         return UnoRuntime.queryInterface( aInterfaceClass, xAsChild.getParent() );
     }
@@ -179,7 +179,7 @@
     */
     static public void disposeComponent( Object xComp ) throws java.lang.RuntimeException
     {
-        XComponent xComponent = (XComponent)UnoRuntime.queryInterface( XComponent.class,
+        XComponent xComponent = UnoRuntime.queryInterface( XComponent.class,
             xComp );
         if ( null != xComponent )
             xComponent.dispose();
@@ -190,7 +190,7 @@
     */
     static public Object getModel( Object aControl, Class aInterfaceClass )
     {
-        XControl xControl = (XControl)UnoRuntime.queryInterface(
+        XControl xControl = UnoRuntime.queryInterface(
             XControl.class, aControl );
         XControlModel xModel = null;
         if ( null != xControl )
diff --git a/odk/examples/DevelopersGuide/Forms/FormLayer.java 
b/odk/examples/DevelopersGuide/Forms/FormLayer.java
index 1436591..e7eb069 100644
--- a/odk/examples/DevelopersGuide/Forms/FormLayer.java
+++ b/odk/examples/DevelopersGuide/Forms/FormLayer.java
@@ -87,9 +87,9 @@
         int nYPos, int nWidth, int nHeight, XIndexContainer xParentForm ) throws 
java.lang.Exception
     {
         // let the document create a shape
-        XMultiServiceFactory xDocAsFactory = (XMultiServiceFactory)UnoRuntime.queryInterface(
+        XMultiServiceFactory xDocAsFactory = UnoRuntime.queryInterface(
             XMultiServiceFactory.class, m_document.getDocument() );
-        XControlShape xShape = (XControlShape)UnoRuntime.queryInterface( XControlShape.class,
+        XControlShape xShape = UnoRuntime.queryInterface( XControlShape.class,
             xDocAsFactory.createInstance( "com.sun.star.drawing.ControlShape" ) );
 
         // position and size of the shape
@@ -103,7 +103,7 @@
 
         // create the form component (the model of a form control)
         String sQualifiedComponentName = "com.sun.star.form.component." + sFormComponentService;
-        XControlModel xModel = (XControlModel)UnoRuntime.queryInterface( XControlModel.class,
+        XControlModel xModel = UnoRuntime.queryInterface( XControlModel.class,
             m_document.getOrb().createInstance( sQualifiedComponentName ) );
 
         // insert the model into the form component hierarchy, if the caller gave us a location
@@ -118,7 +118,7 @@
         // add the shape to the shapes collection of the document
         XDrawPage pageWhereToInsert = ( m_insertPage != -1 ) ? m_document.getDrawPage( 
m_insertPage ) : m_document.getMainDrawPage();
 
-        XShapes xDocShapes = (XShapes)UnoRuntime.queryInterface( XShapes.class, pageWhereToInsert 
);
+        XShapes xDocShapes = UnoRuntime.queryInterface( XShapes.class, pageWhereToInsert );
         xDocShapes.add( xShape );
 
         // some initializations which are the same for all controls
@@ -240,7 +240,7 @@
     */
     public XPropertySet getRadioModelByRefValue( XPropertySet form, String name, String refValue ) 
throws com.sun.star.uno.Exception, java.lang.Exception
     {
-        XIndexAccess indexAccess = (XIndexAccess)UnoRuntime.queryInterface( XIndexAccess.class,
+        XIndexAccess indexAccess = UnoRuntime.queryInterface( XIndexAccess.class,
             form );
 
         for ( int i=0; i<indexAccess.getCount(); ++i )
@@ -265,7 +265,7 @@
     */
     public XPropertySet getRadioModelByTag( XPropertySet form, String name, String tag ) throws 
com.sun.star.uno.Exception, java.lang.Exception
     {
-        XIndexAccess indexAccess = (XIndexAccess)UnoRuntime.queryInterface( XIndexAccess.class,
+        XIndexAccess indexAccess = UnoRuntime.queryInterface( XIndexAccess.class,
             form );
 
         for ( int i=0; i<indexAccess.getCount(); ++i )
diff --git a/odk/examples/DevelopersGuide/Forms/GridFieldValidator.java 
b/odk/examples/DevelopersGuide/Forms/GridFieldValidator.java
index e32cccc..073289f 100644
--- a/odk/examples/DevelopersGuide/Forms/GridFieldValidator.java
+++ b/odk/examples/DevelopersGuide/Forms/GridFieldValidator.java
@@ -72,7 +72,7 @@
         if ( bEnable == m_bWatching )
             return;
 
-        XUpdateBroadcaster xUpdate = (XUpdateBroadcaster)UnoRuntime.queryInterface(
+        XUpdateBroadcaster xUpdate = UnoRuntime.queryInterface(
             XUpdateBroadcaster.class, m_xWatchedColumn );
 
         if ( bEnable )
@@ -105,7 +105,7 @@
             );
 
             // instantiate an interaction handler who can handle SQLExceptions
-            XInteractionHandler xHandler = (XInteractionHandler)UnoRuntime.queryInterface(
+            XInteractionHandler xHandler = UnoRuntime.queryInterface(
                 XInteractionHandler.class,
                 m_xCtx.getServiceManager().createInstanceWithContext(
                     "com.sun.star.task.InteractionHandler", m_xCtx ) );
diff --git a/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java 
b/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java
index 01a364c..d56501a 100644
--- a/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java
+++ b/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java
@@ -65,9 +65,9 @@
     {
         m_databaseDocumentFile = _docURL;
 
-        XNameAccess dbContext = (XNameAccess)UnoRuntime.queryInterface( XNameAccess.class,
+        XNameAccess dbContext = UnoRuntime.queryInterface( XNameAccess.class,
             m_context.getServiceManager().createInstanceWithContext( 
"com.sun.star.sdb.DatabaseContext", m_context ) );
-        XDocumentDataSource dataSource = (XDocumentDataSource)UnoRuntime.queryInterface( 
XDocumentDataSource.class,
+        XDocumentDataSource dataSource = UnoRuntime.queryInterface( XDocumentDataSource.class,
             dbContext.getByName( _docURL ) );
 
         m_databaseDocument = dataSource.getDatabaseDocument();
@@ -81,14 +81,14 @@
         documentFile.deleteOnExit();
         m_databaseDocumentFile = URLHelper.getFileURLFromSystemPath( documentFile );
 
-        m_databaseDocument = (XOfficeDatabaseDocument)UnoRuntime.queryInterface(
+        m_databaseDocument = UnoRuntime.queryInterface(
             XOfficeDatabaseDocument.class, m_context.getServiceManager().createInstanceWithContext(
                 "com.sun.star.sdb.OfficeDatabaseDocument", m_context ) );
 
-        XPropertySet dsProperties = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, 
m_databaseDocument.getDataSource() );
+        XPropertySet dsProperties = UnoRuntime.queryInterface( XPropertySet.class, 
m_databaseDocument.getDataSource() );
         dsProperties.setPropertyValue("URL", "sdbc:embedded:hsqldb");
 
-        XStorable storable = (XStorable)UnoRuntime.queryInterface( XStorable.class, 
m_databaseDocument );
+        XStorable storable = UnoRuntime.queryInterface( XStorable.class, m_databaseDocument );
         storable.storeAsURL( m_databaseDocumentFile, new PropertyValue[]{} );
     }
 
@@ -120,7 +120,7 @@
     {
         if ( m_databaseDocument != null )
         {
-            XStorable storeDoc = (XStorable)UnoRuntime.queryInterface( XStorable.class,
+            XStorable storeDoc = UnoRuntime.queryInterface( XStorable.class,
                 m_databaseDocument );
             storeDoc.store();
         }
@@ -134,7 +134,7 @@
     public void close()
     {
         // close connection
-        XCloseable closeConn = (XCloseable)UnoRuntime.queryInterface( XCloseable.class,
+        XCloseable closeConn = UnoRuntime.queryInterface( XCloseable.class,
             m_connection );
         if ( closeConn != null )
         {
@@ -149,7 +149,7 @@
         m_connection = null;
 
         // close document
-        com.sun.star.util.XCloseable closeDoc = 
(com.sun.star.util.XCloseable)UnoRuntime.queryInterface(
+        com.sun.star.util.XCloseable closeDoc = UnoRuntime.queryInterface(
             com.sun.star.util.XCloseable.class, m_databaseDocument );
         if ( closeDoc != null )
         {
@@ -202,7 +202,7 @@
     */
     XModel getModel()
     {
-        return (XModel)UnoRuntime.queryInterface( XModel.class, m_databaseDocument );
+        return UnoRuntime.queryInterface( XModel.class, m_databaseDocument );
     }
 
     /** returns the URL of the ODB document represented by this instance
diff --git a/odk/examples/DevelopersGuide/Forms/KeyGenerator.java 
b/odk/examples/DevelopersGuide/Forms/KeyGenerator.java
index 85a56ac..d3e7466 100644
--- a/odk/examples/DevelopersGuide/Forms/KeyGenerator.java
+++ b/odk/examples/DevelopersGuide/Forms/KeyGenerator.java
@@ -64,19 +64,19 @@
         if ( CommandType.COMMAND == aCommandType.intValue() )
         {
             // get the connection from the form
-            XConnection xFormConn = (XConnection)UnoRuntime.queryInterface( XConnection.class,
+            XConnection xFormConn = UnoRuntime.queryInterface( XConnection.class,
                 xForm.getPropertyValue( "ActiveConnection" ) );
             // and let it create a composer for us
             XSQLQueryComposerFactory xComposerFac =
-                (XSQLQueryComposerFactory)UnoRuntime.queryInterface(
-                    XSQLQueryComposerFactory.class, xFormConn );
+                UnoRuntime.queryInterface(
+                XSQLQueryComposerFactory.class, xFormConn );
             XSQLQueryComposer xComposer = xComposerFac.createQueryComposer( );
 
             // let this composer analyze the command
             xComposer.setQuery( sCommand );
 
             // and ask it for the table(s)
-            XTablesSupplier xSuppTables = (XTablesSupplier)UnoRuntime.queryInterface(
+            XTablesSupplier xSuppTables = UnoRuntime.queryInterface(
                 XTablesSupplier.class, xComposer );
             XNameAccess xTables = xSuppTables.getTables();
 
@@ -126,7 +126,7 @@
     protected int generatePrimaryKey( XPropertySet xForm, String sFieldName ) throws 
com.sun.star.uno.Exception
     {
         // get the current connection of the form
-        XConnection xConn = (XConnection)UnoRuntime.queryInterface(
+        XConnection xConn = UnoRuntime.queryInterface(
             XConnection.class, xForm.getPropertyValue( "ActiveConnection" ) );
         // let it create a new statement
         XStatement xStatement = xConn.createStatement();
@@ -141,7 +141,7 @@
         xResults.next( );
 
         // get the value
-        XRow xRow = (XRow)UnoRuntime.queryInterface( XRow.class, xResults );
+        XRow xRow = UnoRuntime.queryInterface( XRow.class, xResults );
         int nFreeValue = xRow.getInt( 1 );
 
         // dispose the temporary objects
@@ -165,10 +165,10 @@
         if ( ResultSetConcurrency.READ_ONLY != aConcurrency.intValue() )
         {
             // get the column object
-            XColumnsSupplier xSuppCols = (XColumnsSupplier)UnoRuntime.queryInterface(
+            XColumnsSupplier xSuppCols = UnoRuntime.queryInterface(
                 XColumnsSupplier.class, xForm );
             XNameAccess xCols = xSuppCols.getColumns();
-            XColumnUpdate xCol = (XColumnUpdate)UnoRuntime.queryInterface(
+            XColumnUpdate xCol = UnoRuntime.queryInterface(
                 XColumnUpdate.class, xCols.getByName( sFieldName ) );
 
             xCol.updateInt( generatePrimaryKey( xForm, sFieldName ) );
@@ -204,7 +204,7 @@
     */
     public void defaultNewRecordFocus( XPropertySet xForm ) throws com.sun.star.uno.Exception
     {
-        XIndexAccess xFormAsContainer = (XIndexAccess)UnoRuntime.queryInterface(
+        XIndexAccess xFormAsContainer = UnoRuntime.queryInterface(
             XIndexAccess.class, xForm );
         for ( int i = 0; i<xFormAsContainer.getCount(); ++i )
         {
@@ -390,7 +390,7 @@
         XReset xFormReset = UNO.queryReset( m_xForm );
         xFormReset.removeResetListener( m_aResetKeyGenerator );
 
-        XRowSetApproveBroadcaster xFormBroadcaster = 
(XRowSetApproveBroadcaster)UnoRuntime.queryInterface(
+        XRowSetApproveBroadcaster xFormBroadcaster = UnoRuntime.queryInterface(
             XRowSetApproveBroadcaster.class, m_xForm );
         xFormBroadcaster.removeRowSetApproveListener( m_aUpdateKeyGenerator );
 
@@ -405,7 +405,7 @@
         // for resets
         XReset xFormReset = UNO.queryReset( m_xForm );
         // for approving actions
-        XRowSetApproveBroadcaster xFormBroadcaster = 
(XRowSetApproveBroadcaster)UnoRuntime.queryInterface(
+        XRowSetApproveBroadcaster xFormBroadcaster = UnoRuntime.queryInterface(
             XRowSetApproveBroadcaster.class, m_xForm );
 
         if ( bGenerateOnReset )
diff --git a/odk/examples/DevelopersGuide/Forms/RowSet.java 
b/odk/examples/DevelopersGuide/Forms/RowSet.java
index acd56f9..b533881 100644
--- a/odk/examples/DevelopersGuide/Forms/RowSet.java
+++ b/odk/examples/DevelopersGuide/Forms/RowSet.java
@@ -45,14 +45,14 @@
     {
         try
         {
-            m_rowSetProps = (XPropertySet)UnoRuntime.queryInterface(
+            m_rowSetProps = UnoRuntime.queryInterface(
                 XPropertySet.class, _context.getServiceManager().createInstanceWithContext( 
"com.sun.star.sdb.RowSet", _context ) );
             m_rowSetProps.setPropertyValue( "DataSourceName", _dataSource );
             m_rowSetProps.setPropertyValue( "CommandType", new Integer( _commandType ) );
             m_rowSetProps.setPropertyValue( "Command", _command );
 
-            m_rowSet = (XRowSet)UnoRuntime.queryInterface( XRowSet.class, m_rowSetProps );
-            m_row = (XRow)UnoRuntime.queryInterface( XRow.class, m_rowSetProps );
+            m_rowSet = UnoRuntime.queryInterface( XRowSet.class, m_rowSetProps );
+            m_row = UnoRuntime.queryInterface( XRow.class, m_rowSetProps );
         }
         catch ( Exception e )
         {
@@ -64,9 +64,9 @@
     // misc
     public int getColumnCount()
     {
-        XColumnsSupplier suppCols = (XColumnsSupplier)UnoRuntime.queryInterface(
+        XColumnsSupplier suppCols = UnoRuntime.queryInterface(
             XColumnsSupplier.class, m_rowSet );
-        XIndexAccess columns = (XIndexAccess)UnoRuntime.queryInterface(
+        XIndexAccess columns = UnoRuntime.queryInterface(
             XIndexAccess.class, suppCols.getColumns() );
         return columns.getCount();
     }
diff --git a/odk/examples/DevelopersGuide/Forms/SalesFilter.java 
b/odk/examples/DevelopersGuide/Forms/SalesFilter.java
index 9fc5617..df7e96a 100644
--- a/odk/examples/DevelopersGuide/Forms/SalesFilter.java
+++ b/odk/examples/DevelopersGuide/Forms/SalesFilter.java
@@ -433,7 +433,7 @@
             m_xSalesForm.setPropertyValue( "ApplyFilter", new Boolean( true ) );
 
             // and reload the form
-            XLoadable xLoad = (XLoadable)UnoRuntime.queryInterface(
+            XLoadable xLoad = UnoRuntime.queryInterface(
                 XLoadable.class, m_xSalesForm );
             xLoad.reload();
 
diff --git a/odk/examples/DevelopersGuide/Forms/SingleControlValidation.java 
b/odk/examples/DevelopersGuide/Forms/SingleControlValidation.java
index 50b5964..c542834 100644
--- a/odk/examples/DevelopersGuide/Forms/SingleControlValidation.java
+++ b/odk/examples/DevelopersGuide/Forms/SingleControlValidation.java
@@ -96,7 +96,7 @@
                 if ( controls[ i ].getPropertySetInfo().hasPropertyByName( "Border" ) )
                     controls[ i ].setPropertyValue( "Border", new Short( (short)2 ) );
 
-                XValidatableFormComponent xComp = 
(XValidatableFormComponent)UnoRuntime.queryInterface( XValidatableFormComponent.class,
+                XValidatableFormComponent xComp = UnoRuntime.queryInterface( 
XValidatableFormComponent.class,
                     controls[ i ] );
                 xComp.addFormComponentValidityListener( this );
             }
@@ -118,7 +118,7 @@
             m_explanationField = m_formLayer.createControlAndShape( "FixedText", columnPos, 
controlPos, 70, 4, null );
             m_explanationField.setPropertyValue( "Label", new String( "" ) );
 
-            XValidatable xValidatable = (XValidatable)UnoRuntime.queryInterface( 
XValidatable.class, m_inputField );
+            XValidatable xValidatable = UnoRuntime.queryInterface( XValidatable.class, 
m_inputField );
             xValidatable.setValidator( m_validator );
         }
         catch( java.lang.Exception e  )
@@ -144,7 +144,7 @@
         {
             if ( m_inputField.equals( eventObject.Source ) )
             {
-                XValidatableFormComponent xComp = 
(XValidatableFormComponent)UnoRuntime.queryInterface( XValidatableFormComponent.class,
+                XValidatableFormComponent xComp = UnoRuntime.queryInterface( 
XValidatableFormComponent.class,
                     eventObject.Source );
                 // the current value
                 Object value = xComp.getCurrentValue();
diff --git a/odk/examples/DevelopersGuide/Forms/SpreadsheetDocument.java 
b/odk/examples/DevelopersGuide/Forms/SpreadsheetDocument.java
index c722bf3..1016f49 100644
--- a/odk/examples/DevelopersGuide/Forms/SpreadsheetDocument.java
+++ b/odk/examples/DevelopersGuide/Forms/SpreadsheetDocument.java
@@ -40,13 +40,13 @@
 
     public XCellRange getSheet( int index ) throws com.sun.star.uno.Exception
     {
-        XSpreadsheetDocument spreadsheetDoc = (XSpreadsheetDocument)UnoRuntime.queryInterface( 
XSpreadsheetDocument.class,
+        XSpreadsheetDocument spreadsheetDoc = UnoRuntime.queryInterface( 
XSpreadsheetDocument.class,
             m_documentComponent
         );
-        XIndexAccess sheets = (XIndexAccess)UnoRuntime.queryInterface( XIndexAccess.class,
+        XIndexAccess sheets = UnoRuntime.queryInterface( XIndexAccess.class,
             spreadsheetDoc.getSheets()
         );
-        return (XCellRange)UnoRuntime.queryInterface( XCellRange.class,
+        return UnoRuntime.queryInterface( XCellRange.class,
             sheets.getByIndex( index )
         );
     }
@@ -74,7 +74,7 @@
         {
             CellAddress address = new CellAddress( sheet, column, row );
             Object[] initParam = new Object[] { new NamedValue( "BoundCell", address ) };
-            cellBinding = (com.sun.star.form.binding.XValueBinding)UnoRuntime.queryInterface(
+            cellBinding = UnoRuntime.queryInterface(
                 com.sun.star.form.binding.XValueBinding.class,
                 createInstanceWithArguments(
                     supportIntegerValues ? "com.sun.star.table.ListPositionCellBinding"
@@ -102,7 +102,7 @@
             CellRangeAddress rangeAddress = new CellRangeAddress( sheet, column,
                 topRow, column, bottomRow );
             Object[] initParam = new Object[] { new NamedValue( "CellRange", rangeAddress ) };
-            entrySource = (com.sun.star.form.binding.XListEntrySource)UnoRuntime.queryInterface(
+            entrySource = UnoRuntime.queryInterface(
                 com.sun.star.form.binding.XListEntrySource.class,
                 createInstanceWithArguments(
                     "com.sun.star.table.CellRangeListSource", initParam ) );
diff --git a/odk/examples/DevelopersGuide/Forms/SpreadsheetValueBinding.java 
b/odk/examples/DevelopersGuide/Forms/SpreadsheetValueBinding.java
index 5b7c1c1..09233ad 100644
--- a/odk/examples/DevelopersGuide/Forms/SpreadsheetValueBinding.java
+++ b/odk/examples/DevelopersGuide/Forms/SpreadsheetValueBinding.java
@@ -74,7 +74,7 @@
             listSourceSheet, column, topRow, bottomRow );
 
         // bind it to the list box
-        XListEntrySink consumer = (XListEntrySink)UnoRuntime.queryInterface(
+        XListEntrySink consumer = UnoRuntime.queryInterface(
             XListEntrySink.class, listBox );
         consumer.setListEntrySource( entrySource );
 
@@ -87,7 +87,7 @@
         String[] listContent = new String[] { "first", "second", "third", "forth", "fivth" };
         for ( short row = topRow; row <= bottomRow; ++row )
         {
-            XTextRange cellText = (XTextRange)UnoRuntime.queryInterface(
+            XTextRange cellText = UnoRuntime.queryInterface(
                 XTextRange.class, exchangeSheet.getCellByPosition( column, row ) );
             cellText.setString( listContent[row] );
         }
@@ -104,7 +104,7 @@
     /* ------------------------------------------------------------------ */
     private void implBind( XPropertySet controlModel, XValueBinding binding ) throws 
com.sun.star.form.binding.IncompatibleTypesException
     {
-        XBindableValue bindable = (XBindableValue)UnoRuntime.queryInterface(
+        XBindableValue bindable = UnoRuntime.queryInterface(
             XBindableValue.class, controlModel
         );
         bindable.setValueBinding( binding );
diff --git a/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java 
b/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java
index 679c520..21dfb94 100644
--- a/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java
+++ b/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java
@@ -43,16 +43,16 @@
         try
         {
             // get the sheet to activate
-            XSpreadsheetDocument doc = (XSpreadsheetDocument)UnoRuntime.queryInterface(
+            XSpreadsheetDocument doc = UnoRuntime.queryInterface(
                 XSpreadsheetDocument.class, getDocument().getDocument() );
-            XIndexAccess sheets = (XIndexAccess)UnoRuntime.queryInterface(
+            XIndexAccess sheets = UnoRuntime.queryInterface(
                 XIndexAccess.class, doc.getSheets() );
 
-            XSpreadsheet sheet = (XSpreadsheet)UnoRuntime.queryInterface(
+            XSpreadsheet sheet = UnoRuntime.queryInterface(
                 XSpreadsheet.class, sheets.getByIndex( sheetIndex ) );
 
             // activate
-            XSpreadsheetView view = (XSpreadsheetView)UnoRuntime.queryInterface(
+            XSpreadsheetView view = UnoRuntime.queryInterface(
                 XSpreadsheetView.class, getController() );
             view.setActiveSheet( sheet );
         }
diff --git a/odk/examples/DevelopersGuide/Forms/UNO.java 
b/odk/examples/DevelopersGuide/Forms/UNO.java
index 3954061..109618c 100644
--- a/odk/examples/DevelopersGuide/Forms/UNO.java
+++ b/odk/examples/DevelopersGuide/Forms/UNO.java
@@ -45,37 +45,37 @@
 {
     public static XPropertySet queryPropertySet( Object aObject )
     {
-        return (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, aObject );
+        return UnoRuntime.queryInterface( XPropertySet.class, aObject );
     }
     public static XControlModel queryControlModel( Object aObject )
     {
-        return (XControlModel)UnoRuntime.queryInterface( XControlModel.class, aObject );
+        return UnoRuntime.queryInterface( XControlModel.class, aObject );
     }
     public static XIndexContainer queryIndexContainer( Object aObject )
     {
-        return (XIndexContainer)UnoRuntime.queryInterface( XIndexContainer.class, aObject );
+        return UnoRuntime.queryInterface( XIndexContainer.class, aObject );
     }
     public static XReset queryReset( Object aObject )
     {
-        return (XReset)UnoRuntime.queryInterface( XReset.class, aObject );
+        return UnoRuntime.queryInterface( XReset.class, aObject );
     }
     public static XServiceInfo queryServiceInfo( Object aObject )
     {
-        return (XServiceInfo)UnoRuntime.queryInterface( XServiceInfo.class, aObject );
+        return UnoRuntime.queryInterface( XServiceInfo.class, aObject );
     }
     public static XColumn queryColumn( Object aObject )
     {
-        return (XColumn)UnoRuntime.queryInterface( XColumn.class, aObject );
+        return UnoRuntime.queryInterface( XColumn.class, aObject );
     }
 
     public static XComponent queryComponent( Object aObject )
     {
-        return (XComponent)UnoRuntime.queryInterface( XComponent.class, aObject );
+        return UnoRuntime.queryInterface( XComponent.class, aObject );
     }
 
     public static XTablesSupplier queryTablesSupplier( Object aObject )
     {
-        return (XTablesSupplier)UnoRuntime.queryInterface( XTablesSupplier.class, aObject );
+        return UnoRuntime.queryInterface( XTablesSupplier.class, aObject );
     }
 
 /*  replace Foo with the identifier of your choice.
diff --git a/odk/examples/DevelopersGuide/Forms/ValueBinding.java 
b/odk/examples/DevelopersGuide/Forms/ValueBinding.java
index ffb7555..3cf649c 100644
--- a/odk/examples/DevelopersGuide/Forms/ValueBinding.java
+++ b/odk/examples/DevelopersGuide/Forms/ValueBinding.java
@@ -41,7 +41,7 @@
 
         // insert a table with exactly one cell. The content of this table will be synced with
         // the content of a form control
-        XTextDocument textDoc = (XTextDocument)UnoRuntime.queryInterface( XTextDocument.class,  
m_document.getDocument() );
+        XTextDocument textDoc = UnoRuntime.queryInterface( XTextDocument.class,  
m_document.getDocument() );
         XText documentText = textDoc.getText();
         XTextCursor textCursor = documentText.createTextCursor();
         documentText.insertString( textCursor, "Below, there's a table cell, and a text field. ", 
false );
@@ -49,7 +49,7 @@
         documentText.insertString( textCursor, "That means that anything you insert into the table 
cell is reflected in the ", false );
         documentText.insertString( textCursor, "text field, and vice versa.\n", false );
 
-        XTextTable table = (XTextTable)UnoRuntime.queryInterface( XTextTable.class,
+        XTextTable table = UnoRuntime.queryInterface( XTextTable.class,
             m_document.createInstance( "com.sun.star.text.TextTable" )
         );
         table.initialize( 1, 1 );
@@ -61,7 +61,7 @@
         // create a value binding for the first cell of the table
         XValueBinding cellBinding = new TableCellTextBinding( table.getCellByName( "A1" ) );
         // and bind it to the control
-        XBindableValue bindable = (XBindableValue)UnoRuntime.queryInterface(
+        XBindableValue bindable = UnoRuntime.queryInterface(
             XBindableValue.class, textControl
         );
         bindable.setValueBinding( cellBinding );
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java 
b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java
index c0e165e..70748df 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java
@@ -232,7 +232,7 @@
             maCustomizeView.setFrame(mxFrame);
 
             // be listener for closing the remote target view frame
-            com.sun.star.lang.XComponent xBroadcaster = 
(com.sun.star.lang.XComponent)UnoRuntime.queryInterface(
+            com.sun.star.lang.XComponent xBroadcaster = UnoRuntime.queryInterface(
                 com.sun.star.lang.XComponent.class,
                 mxFrame);
 
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java 
b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java
index 3fb237f..9076fcb 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java
@@ -92,10 +92,10 @@
 
             // Create special service for parsing of given URL.
             com.sun.star.util.XURLTransformer xParser =
-                (com.sun.star.util.XURLTransformer)UnoRuntime.queryInterface(
-                    com.sun.star.util.XURLTransformer.class,
-                    xOfficeCtx.getServiceManager().createInstanceWithContext(
-                        "com.sun.star.util.URLTransformer", xOfficeCtx));
+                UnoRuntime.queryInterface(
+                com.sun.star.util.XURLTransformer.class,
+                xOfficeCtx.getServiceManager().createInstanceWithContext(
+                    "com.sun.star.util.URLTransformer", xOfficeCtx));
 
             // Because it's an in/out parameter we must use an array of URL objects.
             com.sun.star.util.URL[] aParseURL = new com.sun.star.util.URL[1];
@@ -146,7 +146,7 @@
         com.sun.star.frame.XFrame xFrame = null;
 
         try{
-            xFrame = (com.sun.star.frame.XFrame)UnoRuntime.queryInterface(
+            xFrame = UnoRuntime.queryInterface(
                 com.sun.star.frame.XFrame.class,
                 xCtx.getServiceManager().createInstanceWithContext(
                     "com.sun.star.frame.Task", xCtx));
@@ -155,7 +155,7 @@
         if (xFrame==null)
         {
             try{
-                xFrame = (com.sun.star.frame.XFrame)UnoRuntime.queryInterface(
+                xFrame = UnoRuntime.queryInterface(
                     com.sun.star.frame.XFrame.class,
                     xCtx.getServiceManager().createInstanceWithContext(
                         "com.sun.star.frame.Frame", xCtx));
@@ -213,7 +213,7 @@
         // get access to toolkit of remote office to create the container window of
         // new target frame
         try{
-            xToolkit = (com.sun.star.awt.XToolkit)UnoRuntime.queryInterface(
+            xToolkit = UnoRuntime.queryInterface(
                 com.sun.star.awt.XToolkit.class,
                 xCtx.getServiceManager().createInstanceWithContext(
                     "com.sun.star.awt.Toolkit", xCtx));
@@ -257,8 +257,8 @@
             // the remote office. Means if this java client and the remote office
             // use the same display!
             com.sun.star.awt.XSystemChildFactory xChildFactory =
-                (com.sun.star.awt.XSystemChildFactory)UnoRuntime.queryInterface(
-                    com.sun.star.awt.XSystemChildFactory.class, xToolkit);
+                UnoRuntime.queryInterface(
+                com.sun.star.awt.XSystemChildFactory.class, xToolkit);
 
             try
             {
@@ -266,7 +266,7 @@
                 short   nSystem = (short)aParentView.getNativeWindowSystemType();
                 byte[]  lProcID = new byte[0];
 
-                xPeer = xChildFactory.createSystemChild((Object)nHandle,
+                xPeer = xChildFactory.createSystemChild(nHandle,
                                                         lProcID, nSystem);
 
                 if (xPeer==null)
@@ -279,8 +279,8 @@
                         JavaWindowPeerFake(aParentView);
 
                     com.sun.star.awt.XWindowPeer xParentPeer =
-                        (com.sun.star.awt.XWindowPeer)UnoRuntime.queryInterface(
-                            com.sun.star.awt.XWindowPeer.class, aWrapper);
+                        UnoRuntime.queryInterface(
+                        com.sun.star.awt.XWindowPeer.class, aWrapper);
 
                     com.sun.star.awt.WindowDescriptor aDescriptor =
                         new com.sun.star.awt.WindowDescriptor();
@@ -316,7 +316,7 @@
 
         // It doesn't matter which way was used to get the window peer.
         // Cast it to the right return interface and return it.
-        xWindow = (com.sun.star.awt.XWindow)UnoRuntime.queryInterface(
+        xWindow = UnoRuntime.queryInterface(
             com.sun.star.awt.XWindow.class,
             xPeer);
 
@@ -370,7 +370,7 @@
 
             // Insert the new frame in desktop hierarchy.
             // Use XFrames interface to do so. It provides access to the child frame container of 
that instance.
-            com.sun.star.frame.XFramesSupplier xTreeRoot = 
(com.sun.star.frame.XFramesSupplier)UnoRuntime.queryInterface(
+            com.sun.star.frame.XFramesSupplier xTreeRoot = UnoRuntime.queryInterface(
                 com.sun.star.frame.XFramesSupplier.class,
                 xCtx.getServiceManager().createInstanceWithContext(
                     "com.sun.star.frame.Desktop", xCtx));
@@ -395,7 +395,7 @@
                 // After the dispose() call forget all references to this frame and let him die.
                 // If a new exception will occure ... no generell solution exist then.
                 // Nobody can guarantee if next call will work or not.
-                com.sun.star.lang.XComponent xComponent = 
(com.sun.star.lang.XComponent)UnoRuntime.queryInterface(
+                com.sun.star.lang.XComponent xComponent = UnoRuntime.queryInterface(
                     com.sun.star.lang.XComponent.class,
                     xFrame);
                 xComponent.dispose();
@@ -411,7 +411,7 @@
             // Without the desktop service that wasn't possible. So no further rollbacks must 
follow.
             if(xFrame!=null)
             {
-                com.sun.star.lang.XComponent xComponent = 
(com.sun.star.lang.XComponent)UnoRuntime.queryInterface(
+                com.sun.star.lang.XComponent xComponent = UnoRuntime.queryInterface(
                     com.sun.star.lang.XComponent.class,
                     xFrame);
                 xComponent.dispose();
@@ -453,7 +453,7 @@
         try
         {
             // Query the frame for right interface which provides access to all available dispatch 
objects.
-            com.sun.star.frame.XDispatchProvider xProvider = 
(com.sun.star.frame.XDispatchProvider)UnoRuntime.queryInterface(
+            com.sun.star.frame.XDispatchProvider xProvider = UnoRuntime.queryInterface(
                 com.sun.star.frame.XDispatchProvider.class,
                 xFrame);
 
@@ -511,7 +511,7 @@
         try
         {
             // Query the frame for right interface which provides access to all available dispatch 
objects.
-            com.sun.star.frame.XDispatchProvider xProvider = 
(com.sun.star.frame.XDispatchProvider)UnoRuntime.queryInterface(
+            com.sun.star.frame.XDispatchProvider xProvider = UnoRuntime.queryInterface(
                 com.sun.star.frame.XDispatchProvider.class,
                 xFrame);
 
@@ -519,7 +519,7 @@
             // Force THIS frame as target for following dispatch.
             // Attention: The interface XNotifyingDispatch is an optional one!
             com.sun.star.frame.XDispatch xDispatcher = xProvider.queryDispatch(aURL,"",0);
-            com.sun.star.frame.XNotifyingDispatch xNotifyingDispatcher = 
(com.sun.star.frame.XNotifyingDispatch)UnoRuntime.queryInterface(
+            com.sun.star.frame.XNotifyingDispatch xNotifyingDispatcher = UnoRuntime.queryInterface(
                 com.sun.star.frame.XNotifyingDispatch.class,
                 xDispatcher);
 
@@ -571,10 +571,10 @@
             // Get access to the global component loader of the office
             // for synchronous loading the document.
             com.sun.star.frame.XComponentLoader xLoader =
-                (com.sun.star.frame.XComponentLoader)UnoRuntime.queryInterface(
-                    com.sun.star.frame.XComponentLoader.class,
-                    xCtx.getServiceManager().createInstanceWithContext(
-                        "com.sun.star.frame.Desktop", xCtx));
+                UnoRuntime.queryInterface(
+                com.sun.star.frame.XComponentLoader.class,
+                xCtx.getServiceManager().createInstanceWithContext(
+                    "com.sun.star.frame.Desktop", xCtx));
 
             // Load the document into the target frame by using his name and
             // special search flags.
@@ -642,18 +642,18 @@
             // Normaly the application documents (text, spreadsheet ...) do so
             // but some other ones (e.g. db components) doesn't do that.
             // They can't be save then.
-            com.sun.star.frame.XModel xModel = 
(com.sun.star.frame.XModel)UnoRuntime.queryInterface(
+            com.sun.star.frame.XModel xModel = UnoRuntime.queryInterface(
                 com.sun.star.frame.XModel.class,
                 xDocument);
             if(xModel!=null)
             {
                 // Check for modifications => break save process if there is nothing to do.
-                com.sun.star.util.XModifiable xModified = 
(com.sun.star.util.XModifiable)UnoRuntime.queryInterface(
+                com.sun.star.util.XModifiable xModified = UnoRuntime.queryInterface(
                     com.sun.star.util.XModifiable.class,
                     xModel);
                 if(xModified.isModified()==true)
                 {
-                    com.sun.star.frame.XStorable xStore = 
(com.sun.star.frame.XStorable)UnoRuntime.queryInterface(
+                    com.sun.star.frame.XStorable xStore = UnoRuntime.queryInterface(
                         com.sun.star.frame.XStorable.class,
                         xModel);
 
@@ -703,9 +703,8 @@
             // Well known filter names are used directly. They must exist in current
             // office installation. Otherwise this code will fail. But to prevent
             // this code against missing filters it check for existing state of it.
-            com.sun.star.lang.XServiceInfo xInfo = (com.sun.star.lang.XServiceInfo)
-                UnoRuntime.queryInterface(com.sun.star.lang.XServiceInfo.class,
-                                          xDocument);
+            com.sun.star.lang.XServiceInfo xInfo = 
UnoRuntime.queryInterface(com.sun.star.lang.XServiceInfo.class,
+                                      xDocument);
 
             if(xInfo!=null)
             {
@@ -727,11 +726,10 @@
                         OfficeConnect.getOfficeContext();
 
                     com.sun.star.container.XNameAccess xFilterContainer =
-                        (com.sun.star.container.XNameAccess)
                         UnoRuntime.queryInterface(
-                            com.sun.star.container.XNameAccess.class,
-                            xCtx.getServiceManager().createInstanceWithContext(
-                                "com.sun.star.document.FilterFactory", xCtx));
+                        com.sun.star.container.XNameAccess.class,
+                        xCtx.getServiceManager().createInstanceWithContext(
+                            "com.sun.star.document.FilterFactory", xCtx));
 
                     if(xFilterContainer.hasByName(sFilter)==false)
                         sFilter=null;
@@ -755,8 +753,8 @@
                     lProperties[1].Value = Boolean.TRUE;
 
                     com.sun.star.frame.XStorable xStore =
-                        (com.sun.star.frame.XStorable)UnoRuntime.queryInterface(
-                            com.sun.star.frame.XStorable.class, xDocument);
+                        UnoRuntime.queryInterface(
+                        com.sun.star.frame.XStorable.class, xDocument);
 
                     xStore.storeAsURL(sURL,lProperties);
                 }
@@ -797,8 +795,8 @@
         {
             // Check supported functionality of the document (model or controller).
             com.sun.star.frame.XModel xModel =
-                (com.sun.star.frame.XModel)UnoRuntime.queryInterface(
-                    com.sun.star.frame.XModel.class, xDocument);
+                UnoRuntime.queryInterface(
+                com.sun.star.frame.XModel.class, xDocument);
 
             if(xModel!=null)
             {
@@ -806,8 +804,8 @@
                 // Reset the modify state of it and close it.
                 // Note: Model can disgree by throwing a veto exception.
                 com.sun.star.util.XModifiable xModify =
-                    (com.sun.star.util.XModifiable)UnoRuntime.queryInterface(
-                        com.sun.star.util.XModifiable.class, xModel);
+                    UnoRuntime.queryInterface(
+                    com.sun.star.util.XModifiable.class, xModel);
 
                 xModify.setModified(false);
                 xDocument.dispose();
@@ -818,8 +816,8 @@
                 // window only. If it's at least a controller - we can try to
                 // suspend him. But - he can disagree with that!
                 com.sun.star.frame.XController xController =
-                    (com.sun.star.frame.XController)UnoRuntime.queryInterface(
-                        com.sun.star.frame.XController.class, xDocument);
+                    UnoRuntime.queryInterface(
+                    com.sun.star.frame.XController.class, xDocument);
 
                 if(xController!=null)
                 {
@@ -879,8 +877,8 @@
             // It replace the deprecated XTask::close() and should be preferred ...
             // if it can be queried.
             com.sun.star.util.XCloseable xCloseable =
-                (com.sun.star.util.XCloseable)UnoRuntime.queryInterface(
-                    com.sun.star.util.XCloseable.class, xFrame);
+                UnoRuntime.queryInterface(
+                com.sun.star.util.XCloseable.class, xFrame);
             if (xCloseable!=null)
             {
                 // We deliver the owner ship of this frame not to the (possible)
@@ -899,9 +897,8 @@
             else
             {
                 // OK: the new way isn't possible. Try the old one.
-                com.sun.star.frame.XTask xTask = (com.sun.star.frame.XTask)
-                    UnoRuntime.queryInterface(com.sun.star.frame.XTask.class,
-                                              xFrame);
+                com.sun.star.frame.XTask xTask = 
UnoRuntime.queryInterface(com.sun.star.frame.XTask.class,
+                                          xFrame);
                 if (xTask!=null)
                 {
                     // return value doesn't interest here. Because
@@ -946,15 +943,15 @@
         try
         {
             com.sun.star.frame.XFramesSupplier xSupplier =
-                (com.sun.star.frame.XFramesSupplier)UnoRuntime.queryInterface(
-                    com.sun.star.frame.XFramesSupplier.class,
-                    xCtx.getServiceManager().createInstanceWithContext(
-                        "com.sun.star.frame.Desktop", xCtx));
+                UnoRuntime.queryInterface(
+                com.sun.star.frame.XFramesSupplier.class,
+                xCtx.getServiceManager().createInstanceWithContext(
+                    "com.sun.star.frame.Desktop", xCtx));
 
             com.sun.star.container.XIndexAccess xContainer =
-                (com.sun.star.container.XIndexAccess)UnoRuntime.queryInterface(
-                    com.sun.star.container.XIndexAccess.class,
-                    xSupplier.getFrames());
+                UnoRuntime.queryInterface(
+                com.sun.star.container.XIndexAccess.class,
+                xSupplier.getFrames());
 
             int nCount = xContainer.getCount();
             for (int i=0; i<nCount; ++i )
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java 
b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java
index 12ea201..c9fe4f3 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java
@@ -237,7 +237,7 @@
         Vector<Object> lOutParams = new Vector<Object>();
         lOutParams.add(aEvent);
 
-        OnewayExecutor aExecutor = new OnewayExecutor( (IOnewayLink)this                  ,
+        OnewayExecutor aExecutor = new OnewayExecutor( this                  ,
                                                        OnewayExecutor.REQUEST_FRAMEACTION ,
                                                        lOutParams                      );
         aExecutor.start();
@@ -275,7 +275,7 @@
         Vector<Object> lOutParams = OnewayExecutor.encodeDispatch(
                                      lInURL                       ,
                                      lInArguments                 );
-        OnewayExecutor aExecutor = new OnewayExecutor( (IOnewayLink)this               ,
+        OnewayExecutor aExecutor = new OnewayExecutor( this               ,
                                                        OnewayExecutor.REQUEST_DISPATCH ,
                                                        lOutParams                   );
         aExecutor.start();
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/JavaWindowPeerFake.java 
b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/JavaWindowPeerFake.java
index 9100f57..3bc0895 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/JavaWindowPeerFake.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/JavaWindowPeerFake.java
@@ -57,7 +57,7 @@
     {
         Object aReturn = null;
         if(aSystem==maView.maSystem)
-                aReturn = (Object)maView.maHandle;
+                aReturn = maView.maHandle;
         return aReturn;
     }
 
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java 
b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java
index da7f8b7..fd79205 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java
@@ -216,7 +216,7 @@
         Vector<Object> lOutParams   = new Vector<Object>();
         lOutParams.add(aEvent);
 
-        OnewayExecutor aExecutor = new OnewayExecutor( (IOnewayLink)this                  ,
+        OnewayExecutor aExecutor = new OnewayExecutor( this                  ,
                                                        OnewayExecutor.REQUEST_FRAMEACTION ,
                                                        lOutParams                      );
         aExecutor.start();
@@ -357,7 +357,7 @@
         if (! bRegister)
             return;
 
-        com.sun.star.frame.XDispatchProvider xProvider = 
(com.sun.star.frame.XDispatchProvider)UnoRuntime.queryInterface(
+        com.sun.star.frame.XDispatchProvider xProvider = UnoRuntime.queryInterface(
             com.sun.star.frame.XDispatchProvider.class,
             xFrame);
 
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java 
b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java
index f1c47bc..c2fbff2 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java
@@ -205,7 +205,7 @@
             synchronized(mlListener)
             {
                 try{
-                    aListener = (IShutdownListener)mlListener.firstElement();
+                    aListener = mlListener.firstElement();
                 } catch(java.util.NoSuchElementException exEmpty) {}
             }
             if (aListener==null)
diff --git a/odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java 
b/odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java
index f33e71d..00591ec 100644
--- a/odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java
+++ b/odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java
@@ -138,7 +138,7 @@
             // Execute command "open".
             set = UnoRuntime.queryInterface(
                 XDynamicResultSet.class, m_helper.executeCommand( m_content, "open", arg ));
-            XResultSet resultSet = ( XResultSet )set.getStaticResultSet();
+            XResultSet resultSet = set.getStaticResultSet();
 
             result = new Vector<Vector<Object>>();
 
diff --git a/odk/examples/DevelopersGuide/UCB/Helper.java 
b/odk/examples/DevelopersGuide/UCB/Helper.java
index c203904..7bde0ce 100644
--- a/odk/examples/DevelopersGuide/UCB/Helper.java
+++ b/odk/examples/DevelopersGuide/UCB/Helper.java
@@ -76,7 +76,7 @@
             System.out.println("Connected to a running office ...");
         }
 
-        m_ucb = (XInterface)UnoRuntime.queryInterface(
+        m_ucb = UnoRuntime.queryInterface(
             XInterface.class, UniversalContentBroker.create(m_xContext));
     }
 
@@ -103,11 +103,11 @@
 
             // Obtain required UCB interfaces...
             XContentIdentifierFactory idFactory
-                = ( XContentIdentifierFactory )UnoRuntime.queryInterface(
-                    XContentIdentifierFactory.class, m_ucb );
+                = UnoRuntime.queryInterface(
+                XContentIdentifierFactory.class, m_ucb );
             XContentProvider provider
-                = ( XContentProvider )UnoRuntime.queryInterface(
-                    XContentProvider.class, m_ucb );
+                = UnoRuntime.queryInterface(
+                XContentProvider.class, m_ucb );
 
             // Create identifier object for given URL.
             XContentIdentifier id = idFactory.createContentIdentifier( connectURL );
@@ -152,8 +152,8 @@
         /////////////////////////////////////////////////////////////////////
 
         XCommandProcessor cmdProcessor
-            = (XCommandProcessor)UnoRuntime.queryInterface(
-                XCommandProcessor.class, ifc );
+            = UnoRuntime.queryInterface(
+            XCommandProcessor.class, ifc );
 
         /////////////////////////////////////////////////////////////////////
         // Assemble command to execute.
diff --git a/odk/examples/DevelopersGuide/UCB/ResourceCreator.java 
b/odk/examples/DevelopersGuide/UCB/ResourceCreator.java
index 4dc1946..c787108 100644
--- a/odk/examples/DevelopersGuide/UCB/ResourceCreator.java
+++ b/odk/examples/DevelopersGuide/UCB/ResourceCreator.java
@@ -154,7 +154,7 @@
             info.Attributes = 0;
 
             // Create new, empty content (execute command "createNewContent").
-            XContent newContent = ( XContent )UnoRuntime.queryInterface(
+            XContent newContent = UnoRuntime.queryInterface(
                 XContent.class,
                 m_helper.executeCommand( m_content, "createNewContent", info ) );
 
diff --git a/odk/examples/java/Inspector/HideableTreeModel.java 
b/odk/examples/java/Inspector/HideableTreeModel.java
index 21732e6..44c208c 100644
--- a/odk/examples/java/Inspector/HideableTreeModel.java
+++ b/odk/examples/java/Inspector/HideableTreeModel.java
@@ -261,7 +261,7 @@
             if(parent instanceof TreeNode) {
                 TreeNode p = (TreeNode) parent;
                 for(int i = 0, j = -1; i < p.getChildCount(); i++) {
-                    TreeNode pc = (TreeNode)p.getChildAt(i);
+                    TreeNode pc = p.getChildAt(i);
                     if(isNodeVisible(pc)) {
                         j++;
                     }
@@ -279,7 +279,7 @@
             if(parent instanceof TreeNode) {
                 TreeNode p = (TreeNode) parent;
                 for(int i = 0; i < p.getChildCount(); i++) {
-                    TreeNode pc = (TreeNode)p.getChildAt(i);
+                    TreeNode pc = p.getChildAt(i);
                     if(isNodeVisible(pc)) {
                         count++;
                     }
@@ -297,7 +297,7 @@
                 if(isNodeVisible(c)) {
                     index = 0;
                     for(int i = 0; i < p.getChildCount(); i++) {
-                        TreeNode pc = (TreeNode)p.getChildAt(i);
+                        TreeNode pc = p.getChildAt(i);
                         if(pc.equals(c)) {
                             return index;
                         }
diff --git a/odk/examples/java/Inspector/InspectorAddon.java 
b/odk/examples/java/Inspector/InspectorAddon.java
index f7605fd..d5ec168 100644
--- a/odk/examples/java/Inspector/InspectorAddon.java
+++ b/odk/examples/java/Inspector/InspectorAddon.java
@@ -93,7 +93,7 @@
 
         public void initialize( Object[] object ) throws com.sun.star.uno.Exception {
             if ( object.length > 0 ){
-                m_xFrame = ( XFrame ) UnoRuntime.queryInterface(XFrame.class, object[ 0 ] );
+                m_xFrame = UnoRuntime.queryInterface(XFrame.class, object[ 0 ] );
             }
         }
 
@@ -120,14 +120,14 @@
                         com.sun.star.lang.XMultiComponentFactory xMCF = 
m_xContext.getServiceManager();
                         if (xInstInspector == null){
                             Object obj= 
xMCF.createInstanceWithContext("org.openoffice.InstanceInspector", m_xContext);
-                            xInstInspector = 
(org.openoffice.XInstanceInspector)UnoRuntime.queryInterface(org.openoffice.XInstanceInspector.class,
 obj);
+                            xInstInspector = 
UnoRuntime.queryInterface(org.openoffice.XInstanceInspector.class, obj);
                         }
                         if ((m_xFrame == null) || (xModel == null)){
                             Object oDesktop = 
xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", m_xContext);
-                            m_xFrame = (XFrame) UnoRuntime.queryInterface(XFrame.class, oDesktop);
+                            m_xFrame = UnoRuntime.queryInterface(XFrame.class, oDesktop);
                             oUnoInspectObject = m_xFrame;
                         }
-                        XPropertySet xFramePropertySet = (XPropertySet) 
UnoRuntime.queryInterface(XPropertySet.class, m_xFrame);
+                        XPropertySet xFramePropertySet = 
UnoRuntime.queryInterface(XPropertySet.class, m_xFrame);
                         String sTitle = (String) xFramePropertySet.getPropertyValue("Title");
                         String[] sTitleList = sTitle.split(" - ");
                         if (sTitleList.length > 0){
diff --git a/odk/examples/java/Inspector/InspectorPane.java 
b/odk/examples/java/Inspector/InspectorPane.java
index 4933940..11640ce 100644
--- a/odk/examples/java/Inspector/InspectorPane.java
+++ b/odk/examples/java/Inspector/InspectorPane.java
@@ -294,7 +294,7 @@
         //  add all services for the given object to the tree under the node parent
         private void addServicesToTreeNode(XUnoNode _oGrandParentNode, Object _oUnoObject) {
         try{
-            XServiceInfo xServiceInfo = ( XServiceInfo ) UnoRuntime.queryInterface( 
XServiceInfo.class, _oUnoObject );
+            XServiceInfo xServiceInfo = UnoRuntime.queryInterface( XServiceInfo.class, _oUnoObject 
);
             if ( xServiceInfo != null ){
                 String[] sSupportedServiceNames = xServiceInfo.getSupportedServiceNames();
                 for ( int m = 0; m < sSupportedServiceNames.length; m++ ) {
@@ -325,7 +325,7 @@
             for ( int n = 0; n < _aProperties.length; n++ ){
                 Property aProperty = _aProperties[n];
                 XIntrospectionAccess xIntrospectionAccess = 
m_oIntrospector.getXIntrospectionAccess(_oUnoParentObject);
-                XPropertySet xPropertySet = ( XPropertySet ) UnoRuntime.queryInterface( 
XPropertySet.class, xIntrospectionAccess.queryAdapter(new Type( XPropertySet.class)));
+                XPropertySet xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, 
xIntrospectionAccess.queryAdapter(new Type( XPropertySet.class)));
                 if (xPropertySet != null) {
                     if (xPropertySet.getPropertySetInfo().hasPropertyByName(aProperty.Name)){
                         Object objectElement = xPropertySet.getPropertyValue(aProperty.Name);
diff --git a/odk/examples/java/Inspector/ProtocolHandlerAddon.java 
b/odk/examples/java/Inspector/ProtocolHandlerAddon.java
index e20d3a2..00bc253 100644
--- a/odk/examples/java/Inspector/ProtocolHandlerAddon.java
+++ b/odk/examples/java/Inspector/ProtocolHandlerAddon.java
@@ -101,12 +101,12 @@
 
             if ( object.length > 0 )
             {
-                m_xFrame = ( XFrame ) UnoRuntime.queryInterface(
+                m_xFrame = UnoRuntime.queryInterface(
                     XFrame.class, object[ 0 ] );
             }
 
             // Create the toolkit to have access to it later
-            m_xToolkit = (XToolkit) UnoRuntime.queryInterface(
+            m_xToolkit = UnoRuntime.queryInterface(
                 XToolkit.class,
                 m_xCmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.awt.Toolkit",
                                                                         m_xCmpCtx));
@@ -211,7 +211,7 @@
                 aDescriptor.Type              = WindowClass.MODALTOP;
                 aDescriptor.WindowServiceName = new String( "infobox" );
                 aDescriptor.ParentIndex       = -1;
-                aDescriptor.Parent            = (XWindowPeer)UnoRuntime.queryInterface(
+                aDescriptor.Parent            = UnoRuntime.queryInterface(
                     XWindowPeer.class, m_xFrame.getContainerWindow());
                 aDescriptor.Bounds            = new Rectangle(0,0,300,200);
                 aDescriptor.WindowAttributes  = WindowAttribute.BORDER |
@@ -220,7 +220,7 @@
 
                 XWindowPeer xPeer = m_xToolkit.createWindow( aDescriptor );
                 if ( null != xPeer ) {
-                    XMessageBox xMsgBox = (XMessageBox)UnoRuntime.queryInterface(
+                    XMessageBox xMsgBox = UnoRuntime.queryInterface(
                         XMessageBox.class, xPeer);
                     if ( null != xMsgBox )
                     {
diff --git a/odk/examples/java/Inspector/SourceCodeGenerator.java 
b/odk/examples/java/Inspector/SourceCodeGenerator.java
index f8de8c2..5855ed4 100644
--- a/odk/examples/java/Inspector/SourceCodeGenerator.java
+++ b/odk/examples/java/Inspector/SourceCodeGenerator.java
@@ -364,9 +364,9 @@
     private class HeaderStatements extends Vector<String> {
 
         public boolean contains(String _oElement){
-           String sCompName = (String) _oElement;
+           String sCompName = _oElement;
            for (int i = 0; i < this.size(); i++){
-               String sElement = (String) this.get(i);
+               String sElement = this.get(i);
                if (sElement.equals(sCompName)){
                    return true;
                }
diff --git a/odk/examples/java/Inspector/SwingDialogProvider.java 
b/odk/examples/java/Inspector/SwingDialogProvider.java
index 51c56fb..5f5a31b 100644
--- a/odk/examples/java/Inspector/SwingDialogProvider.java
+++ b/odk/examples/java/Inspector/SwingDialogProvider.java
@@ -132,7 +132,7 @@
             if (_nIndex > -1){
                 JPanel jPnlContainerInspectorPanel = (JPanel) 
m_jTabbedPane1.getComponentAt(_nIndex);
                 String sInspectorPanelTitle = m_jTabbedPane1.getTitleAt(_nIndex);
-                oInspectorPane = (InspectorPane) 
m_oInspector.getInspectorPages().get(sInspectorPanelTitle);
+                oInspectorPane = m_oInspector.getInspectorPages().get(sInspectorPanelTitle);
             }
             return oInspectorPane;
         }
diff --git a/odk/examples/java/Inspector/SwingTreeControlProvider.java 
b/odk/examples/java/Inspector/SwingTreeControlProvider.java
index 8ef3b15..f4eb919 100644
--- a/odk/examples/java/Inspector/SwingTreeControlProvider.java
+++ b/odk/examples/java/Inspector/SwingTreeControlProvider.java
@@ -397,7 +397,7 @@
     public XUnoPropertyNode addUnoPropertyNodeWithAttributesDescription(Property _aProperty){
         SwingUnoPropertyNode oUnoPropertyNode = new SwingUnoPropertyNode(_aProperty);
         XConstantTypeDescription[] xPropertyAttributesTypeDescriptions = 
Introspector.getIntrospector().getFieldsOfConstantGroup("com.sun.star.beans.PropertyAttribute");
-        String sDisplay = Introspector.getIntrospector().getConstantDisplayString((int) 
_aProperty.Attributes, xPropertyAttributesTypeDescriptions, "Attributes: ");
+        String sDisplay = 
Introspector.getIntrospector().getConstantDisplayString(_aProperty.Attributes, 
xPropertyAttributesTypeDescriptions, "Attributes: ");
         oUnoPropertyNode.setLabel(sDisplay);
         return oUnoPropertyNode;
     }
diff --git a/odk/examples/java/Inspector/TDocSupplier.java 
b/odk/examples/java/Inspector/TDocSupplier.java
index c0afd57..7f34d13 100644
--- a/odk/examples/java/Inspector/TDocSupplier.java
+++ b/odk/examples/java/Inspector/TDocSupplier.java
@@ -78,7 +78,7 @@
             XRow xRow = getXRowOfTDocUrl(_sTDocUrl, "DocumentModel");
             if (xRow != null){
                 Object oModel = xRow.getObject(1, null);
-                XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, oModel);
+                XModel xModel = UnoRuntime.queryInterface(XModel.class, oModel);
                 return xModel;
             }
         }catch(Exception exception){
@@ -108,7 +108,7 @@
             XUniversalContentBroker xUCB = UniversalContentBroker.create( getXComponentContext() );
             XContentIdentifier xId = xUCB.createContentIdentifier(_sTDocUrl);
             XContent xContent = xUCB.queryContent(xId);
-            XCommandProcessor xCmdProcessor = (XCommandProcessor) 
UnoRuntime.queryInterface(XCommandProcessor.class, xContent);
+            XCommandProcessor xCmdProcessor = UnoRuntime.queryInterface(XCommandProcessor.class, 
xContent);
             Property aProperty = new Property();
             aProperty.Name = _sPropertyName; // "DocumentModel";                //DocumentModel
             Command aCommand  = new Command();
@@ -116,7 +116,7 @@
             aCommand.Handle = -1; // not available
             aCommand.Argument = new Property[]{aProperty};
             Object oAny = xCmdProcessor.execute(aCommand, 0, null);
-            XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, oAny);
+            XRow xRow = UnoRuntime.queryInterface(XRow.class, oAny);
             return xRow;
         }catch(Exception exception){
             exception.printStackTrace(System.err);
@@ -136,7 +136,7 @@
         protected String[] getTDocUrls(){
         try{
             Object oSimpleFileAccess = 
getXMultiComponentFactory().createInstanceWithContext("com.sun.star.ucb.SimpleFileAccess", 
getXComponentContext());
-            XSimpleFileAccess xSimpleFileAccess =  (XSimpleFileAccess) 
UnoRuntime.queryInterface(XSimpleFileAccess.class, oSimpleFileAccess);
+            XSimpleFileAccess xSimpleFileAccess =  
UnoRuntime.queryInterface(XSimpleFileAccess.class, oSimpleFileAccess);
             String[] sContent = xSimpleFileAccess.getFolderContents("vnd.sun.star.tdoc:/", false);
             return sContent;
         } catch( Exception e ) {
@@ -152,7 +152,7 @@
         aPropertyValues[0].Name = "Hidden";
         aPropertyValues[0].Value = Boolean.TRUE;
         Object oDesktop = 
getXMultiComponentFactory().createInstanceWithContext("com.sun.star.frame.Desktop", 
getXComponentContext());
-        XComponentLoader xCL = (XComponentLoader) 
UnoRuntime.queryInterface(XComponentLoader.class, oDesktop);
+        XComponentLoader xCL = UnoRuntime.queryInterface(XComponentLoader.class, oDesktop);
         return xCL.loadComponentFromURL(_sUrl, "_default", 0, aPropertyValues);
     }
     catch( Exception exception ) {
diff --git a/odk/examples/java/Inspector/TestInspector.java 
b/odk/examples/java/Inspector/TestInspector.java
index 6b8758b..bd7a38e 100644
--- a/odk/examples/java/Inspector/TestInspector.java
+++ b/odk/examples/java/Inspector/TestInspector.java
@@ -61,14 +61,14 @@
             }
             org.openoffice.XInstanceInspector xInstInspector = null;
             if (obj != null) {
-                xInstInspector = 
(org.openoffice.XInstanceInspector)UnoRuntime.queryInterface(org.openoffice.XInstanceInspector.class,
 obj);
+                xInstInspector = 
UnoRuntime.queryInterface(org.openoffice.XInstanceInspector.class, obj);
             }
 
             /* A desktop environment contains tasks with one or more
                frames in which components can be loaded. Desktop is the
                environment for components which can instanciate within
                frames. */
-            com.sun.star.frame.XComponentLoader xCmpLoader =  
(com.sun.star.frame.XComponentLoader)UnoRuntime.queryInterface( 
com.sun.star.frame.XComponentLoader.class,
+            com.sun.star.frame.XComponentLoader xCmpLoader =  UnoRuntime.queryInterface( 
com.sun.star.frame.XComponentLoader.class,
                     xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", xContext));
 
             // Load a new spreadsheet document, which will be automaticly
diff --git a/odk/examples/java/Inspector/UnoNode.java b/odk/examples/java/Inspector/UnoNode.java
index 9ba110c..92fef18 100644
--- a/odk/examples/java/Inspector/UnoNode.java
+++ b/odk/examples/java/Inspector/UnoNode.java
@@ -170,7 +170,7 @@
     private com.sun.star.util.URL getDispatchURL(String _sURL){
         try {
             Object oTransformer = 
getXMultiComponentFactory().createInstanceWithContext("com.sun.star.util.URLTransformer", 
getXComponentContext());
-            XURLTransformer xTransformer = (XURLTransformer) 
UnoRuntime.queryInterface(XURLTransformer.class, oTransformer);
+            XURLTransformer xTransformer = UnoRuntime.queryInterface(XURLTransformer.class, 
oTransformer);
             com.sun.star.util.URL[] oURL = new com.sun.star.util.URL[1];
             oURL[0] = new com.sun.star.util.URL();
             oURL[0].Complete = _sURL;
@@ -186,7 +186,7 @@
     private XFrame getCurrentFrame(){
     try{
         Object oDesktop = 
getXMultiComponentFactory().createInstanceWithContext("com.sun.star.frame.Desktop", 
getXComponentContext());
-        XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, oDesktop);
+        XDesktop xDesktop = UnoRuntime.queryInterface(XDesktop.class, oDesktop);
         return xDesktop.getCurrentFrame();
     } catch (Exception e) {
         e.printStackTrace(System.err);
@@ -198,7 +198,7 @@
     try {
         com.sun.star.util.URL[] oURLArray = new com.sun.star.util.URL[1];
         oURLArray[0] = oURL;
-        XDispatchProvider xDispatchProvider = (XDispatchProvider) 
UnoRuntime.queryInterface(XDispatchProvider.class, getCurrentFrame());
+        XDispatchProvider xDispatchProvider = UnoRuntime.queryInterface(XDispatchProvider.class, 
getCurrentFrame());
         XDispatch xDispatch = xDispatchProvider.queryDispatch(oURLArray[0], "_top", 
FrameSearchFlag.ALL); // "_self"
         return xDispatch;
     } catch (Exception e) {
@@ -250,7 +250,7 @@
         while (xTDEnumeration.hasMoreElements()) {
             XTypeDescription xTD = xTDEnumeration.nextTypeDescription();
             if (xTD.getName().equals(_sServiceName)){
-                XServiceTypeDescription xServiceTypeDescription = (XServiceTypeDescription) 
UnoRuntime.queryInterface(XServiceTypeDescription.class, xTD);
+                XServiceTypeDescription xServiceTypeDescription = 
UnoRuntime.queryInterface(XServiceTypeDescription.class, xTD);
                 XServiceTypeDescription[] xMandatoryServiceTypeDescriptions =  
xServiceTypeDescription.getMandatoryServices();
                 int nlength = xMandatoryServiceTypeDescriptions.length;
                 sMandatoryServiceNames  = new String[nlength];
@@ -414,7 +414,7 @@
 
 
     public static String getNodeDescription(Object _oUnoObject){
-        XServiceInfo xServiceInfo = ( XServiceInfo ) UnoRuntime.queryInterface( 
XServiceInfo.class, _oUnoObject );
+        XServiceInfo xServiceInfo = UnoRuntime.queryInterface( XServiceInfo.class, _oUnoObject );
         if ( xServiceInfo != null ) {
             return xServiceInfo.getImplementationName();
         }
diff --git a/odk/examples/java/Inspector/UnoPropertyNode.java 
b/odk/examples/java/Inspector/UnoPropertyNode.java
index 24f7573..920300e 100644
--- a/odk/examples/java/Inspector/UnoPropertyNode.java
+++ b/odk/examples/java/Inspector/UnoPropertyNode.java
@@ -97,7 +97,7 @@
     public String getClassName(){
         String sClassName = "";
         if (m_oUnoObject != null){
-            XServiceInfo xServiceInfo = (XServiceInfo) 
UnoRuntime.queryInterface(XServiceInfo.class, m_oUnoObject);
+            XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, 
m_oUnoObject);
             if (xServiceInfo != null){
                 String[] sServiceNames = xServiceInfo.getSupportedServiceNames();
                 for (int i = 0; i < sServiceNames.length; i++){

-- 
To view, visit https://gerrit.libreoffice.org/3566
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1ab8ad5182444fc3eebd2349135a0240ebbe0fd4
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Noel Grandin <noelgrandin@gmail.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.