forked from amazingfate/loongoffice
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>
This commit is contained in:
committed by
Fridrich Strba
parent
4f6adb0585
commit
68b9fb0aae
@ -65,9 +65,9 @@ public class HsqlDatabase
|
||||
{
|
||||
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 @@ public class HsqlDatabase
|
||||
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 @@ public class HsqlDatabase
|
||||
{
|
||||
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 class HsqlDatabase
|
||||
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 @@ public class HsqlDatabase
|
||||
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 @@ public class HsqlDatabase
|
||||
*/
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user