diff options
author | Noel Grandin <noel@peralex.com> | 2013-04-23 09:01:41 +0200 |
---|---|---|
committer | Fridrich Strba <fridrich@documentfoundation.org> | 2013-04-23 10:29:36 +0000 |
commit | 68b9fb0aaeff4aef41dfd6989491b522578ca079 (patch) | |
tree | 91ce6c4395e11b17c7ca652a66bd8ce905afcd7b /odk/examples/DevelopersGuide/Forms/KeyGenerator.java | |
parent | 4f6adb0585037013241bd59e5c869a261c1f20c1 (diff) |
Java cleanup - remove unnecessary casts in the ODK code
Change-Id: I1ab8ad5182444fc3eebd2349135a0240ebbe0fd4
Reviewed-on: https://gerrit.libreoffice.org/3566
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'odk/examples/DevelopersGuide/Forms/KeyGenerator.java')
-rw-r--r-- | odk/examples/DevelopersGuide/Forms/KeyGenerator.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/odk/examples/DevelopersGuide/Forms/KeyGenerator.java b/odk/examples/DevelopersGuide/Forms/KeyGenerator.java index 85a56aca3eeb..d3e74669bcb0 100644 --- a/odk/examples/DevelopersGuide/Forms/KeyGenerator.java +++ b/odk/examples/DevelopersGuide/Forms/KeyGenerator.java @@ -64,19 +64,19 @@ class UniqueColumnValue 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 @@ class UniqueColumnValue 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 @@ class UniqueColumnValue 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 @@ class UniqueColumnValue 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 @@ class KeyGeneratorForReset extends UniqueColumnValue implements XResetListener */ 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 @@ public class KeyGenerator 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 @@ public class KeyGenerator // 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 ) |