summaryrefslogtreecommitdiff
path: root/reportbuilder
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-04-17 14:59:35 +0200
committerFridrich Strba <fridrich@documentfoundation.org>2013-04-19 07:52:08 +0000
commit8d87758d65e4a03271f76e354dfc84c1fcd5fe21 (patch)
treebc8f4f0df6981ad10fe1333db1a2b015ea079709 /reportbuilder
parentd62425cc27e04a3237cfec2ea2663b8b11284ec8 (diff)
Java cleanup, remove the rest of the unnecessary casts
Change-Id: Ia61d250f6b3711abc29569c5ece38a6f87e38daa Reviewed-on: https://gerrit.libreoffice.org/3432 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'reportbuilder')
-rw-r--r--reportbuilder/java/org/libreoffice/report/SDBCReportData.java12
-rw-r--r--reportbuilder/java/org/libreoffice/report/SDBCReportDataFactory.java24
-rw-r--r--reportbuilder/java/org/libreoffice/report/SOImageService.java6
-rw-r--r--reportbuilder/java/org/libreoffice/report/StorageRepository.java12
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/SOFormulaParser.java2
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java16
6 files changed, 36 insertions, 36 deletions
diff --git a/reportbuilder/java/org/libreoffice/report/SDBCReportData.java b/reportbuilder/java/org/libreoffice/report/SDBCReportData.java
index c05d6b8e4178..5656a950a84c 100644
--- a/reportbuilder/java/org/libreoffice/report/SDBCReportData.java
+++ b/reportbuilder/java/org/libreoffice/report/SDBCReportData.java
@@ -52,7 +52,7 @@ public class SDBCReportData implements DataSource
public SDBCReportData(final XRowSet rowSet) throws SQLException
{
- row = (XRow) UnoRuntime.queryInterface(XRow.class, rowSet);
+ row = UnoRuntime.queryInterface(XRow.class, rowSet);
this.rowSet = rowSet;
if (rowSet == null)
@@ -64,17 +64,17 @@ public class SDBCReportData implements DataSource
}
else
{
- final XParametersSupplier xSuppParams = (XParametersSupplier) UnoRuntime.queryInterface(
+ final XParametersSupplier xSuppParams = UnoRuntime.queryInterface(
XParametersSupplier.class, rowSet);
if (xSuppParams != null)
{
parameters = xSuppParams.getParameters();
}
- final XColumnsSupplier columnsSup = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, rowSet);
+ final XColumnsSupplier columnsSup = UnoRuntime.queryInterface(XColumnsSupplier.class, rowSet);
final XNameAccess columns = columnsSup.getColumns();
final String[] columnNamesList = columns.getElementNames();
- final XResultSetMetaDataSupplier sup = (XResultSetMetaDataSupplier) UnoRuntime.queryInterface(XResultSetMetaDataSupplier.class, rowSet);
+ final XResultSetMetaDataSupplier sup = UnoRuntime.queryInterface(XResultSetMetaDataSupplier.class, rowSet);
final XResultSetMetaData resultSetMetaData = sup.getMetaData();
columnCount = resultSetMetaData.getColumnCount();
@@ -98,7 +98,7 @@ public class SDBCReportData implements DataSource
{
try
{
- final XPropertySet paramColumn = (XPropertySet) UnoRuntime.queryInterface(
+ final XPropertySet paramColumn = UnoRuntime.queryInterface(
XPropertySet.class, parameters.getByIndex(i - firstParameterIndex));
columnNames[i - 1] = (String) paramColumn.getPropertyValue("Name");
columnTypes[i - 1] = (Integer) paramColumn.getPropertyValue("Type");
@@ -287,7 +287,7 @@ public class SDBCReportData implements DataSource
final boolean wasNull;
if (isParameterValue)
{
- final XPropertySet paramCol = (XPropertySet) UnoRuntime.queryInterface(
+ final XPropertySet paramCol = UnoRuntime.queryInterface(
XPropertySet.class, parameters.getByIndex(column - firstParameterIndex));
obj = paramCol.getPropertyValue("Value");
wasNull = obj == null;
diff --git a/reportbuilder/java/org/libreoffice/report/SDBCReportDataFactory.java b/reportbuilder/java/org/libreoffice/report/SDBCReportDataFactory.java
index f6c4658e44d4..20709e8eca69 100644
--- a/reportbuilder/java/org/libreoffice/report/SDBCReportDataFactory.java
+++ b/reportbuilder/java/org/libreoffice/report/SDBCReportDataFactory.java
@@ -208,10 +208,10 @@ public class SDBCReportDataFactory implements DataSourceFactory
fillParameter(parameters, rowSet, paramDef);
rowSetCreated = rowSetCreated && (maxRows == null || maxRows == 0);
- final XCompletedExecution execute = (XCompletedExecution) UnoRuntime.queryInterface(XCompletedExecution.class, rowSet);
+ final XCompletedExecution execute = UnoRuntime.queryInterface(XCompletedExecution.class, rowSet);
if (rowSetCreated && execute != null && paramDef.parameterCount > 0)
{
- final XInteractionHandler handler = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, m_cmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.sdb.InteractionHandler", m_cmpCtx));
+ final XInteractionHandler handler = UnoRuntime.queryInterface(XInteractionHandler.class, m_cmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.sdb.InteractionHandler", m_cmpCtx));
execute.executeWithCompletion(handler);
}
else
@@ -306,7 +306,7 @@ public class SDBCReportDataFactory implements DataSourceFactory
parameter[0] = int.class;
parameter[1] = String.class;
parameter[2] = out.getClass();
- final XConnectionTools tools = (XConnectionTools) UnoRuntime.queryInterface(XConnectionTools.class, connection);
+ final XConnectionTools tools = UnoRuntime.queryInterface(XConnectionTools.class, connection);
try
{
tools.getClass().getMethod("getFieldsByCommandDescriptor", parameter);
@@ -362,7 +362,7 @@ public class SDBCReportDataFactory implements DataSourceFactory
final ArrayList<?> masterValues = (ArrayList<?>) parameters.get(MASTER_VALUES);
if (masterValues != null && !masterValues.isEmpty())
{
- final XParameters para = (XParameters) UnoRuntime.queryInterface(XParameters.class, rowSet);
+ final XParameters para = UnoRuntime.queryInterface(XParameters.class, rowSet);
for (int i = 0;
i < masterValues.size();
@@ -392,8 +392,8 @@ public class SDBCReportDataFactory implements DataSourceFactory
}
rowSetCreated = true;
- final XRowSet rowSet = (XRowSet) UnoRuntime.queryInterface(XRowSet.class, m_cmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.sdb.RowSet", m_cmpCtx));
- final XPropertySet rowSetProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, rowSet);
+ final XRowSet rowSet = UnoRuntime.queryInterface(XRowSet.class, m_cmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.sdb.RowSet", m_cmpCtx));
+ final XPropertySet rowSetProp = UnoRuntime.queryInterface(XPropertySet.class, rowSet);
rowSetProp.setPropertyValue("ActiveConnection", connection);
rowSetProp.setPropertyValue(ESCAPEPROCESSING, rowSetProps.escapeProcessing);
@@ -415,7 +415,7 @@ public class SDBCReportDataFactory implements DataSourceFactory
rowSetProp.setPropertyValue("MaxRows", rowSetProps.maxRows);
}
- final XConnectionTools tools = (XConnectionTools) UnoRuntime.queryInterface(XConnectionTools.class, connection);
+ final XConnectionTools tools = UnoRuntime.queryInterface(XConnectionTools.class, connection);
fillOrderStatement(rowSetProps.command, rowSetProps.commandType, parameters, tools, rowSetProp);
final ParameterDefinition paramDef = createParameter(parameters, tools, rowSetProps, rowSet);
@@ -441,7 +441,7 @@ public class SDBCReportDataFactory implements DataSourceFactory
final XSingleSelectQueryComposer composer = getComposer(tools, rowSetProps.command, rowSetProps.commandType);
if (composer != null)
{
- final XPropertySet rowSetProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, rowSet);
+ final XPropertySet rowSetProp = UnoRuntime.queryInterface(XPropertySet.class, rowSet);
if ((Boolean) rowSetProp.getPropertyValue(APPLY_FILTER))
{
composer.setFilter((String) rowSetProp.getPropertyValue("Filter"));
@@ -449,7 +449,7 @@ public class SDBCReportDataFactory implements DataSourceFactory
// get old parameter count
final ArrayList<?> detailColumns = (ArrayList<?>) parameters.get(DETAIL_COLUMNS);
final ArrayList<String> handledColumns = new ArrayList<String>();
- final XParametersSupplier paraSup = (XParametersSupplier) UnoRuntime.queryInterface(XParametersSupplier.class, composer);
+ final XParametersSupplier paraSup = UnoRuntime.queryInterface(XParametersSupplier.class, composer);
if (paraSup != null)
{
final XIndexAccess params = paraSup.getParameters();
@@ -463,7 +463,7 @@ public class SDBCReportDataFactory implements DataSourceFactory
{
try
{
- final XPropertySet parameter = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, params.getByIndex(i));
+ final XPropertySet parameter = UnoRuntime.queryInterface(XPropertySet.class, params.getByIndex(i));
if (parameter != null)
{
final String name = (String) parameter.getPropertyValue("Name");
@@ -564,11 +564,11 @@ public class SDBCReportDataFactory implements DataSourceFactory
{
if (commandType == CommandType.QUERY)
{
- final XQueriesSupplier xSupplyQueries = (XQueriesSupplier) UnoRuntime.queryInterface(XQueriesSupplier.class, connection);
+ final XQueriesSupplier xSupplyQueries = UnoRuntime.queryInterface(XQueriesSupplier.class, connection);
final XNameAccess queries = xSupplyQueries.getQueries();
if (queries.hasByName(command))
{
- final XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, queries.getByName(command));
+ final XPropertySet prop = UnoRuntime.queryInterface(XPropertySet.class, queries.getByName(command));
final Boolean escape = (Boolean) prop.getPropertyValue(ESCAPEPROCESSING);
rowSetProp.setPropertyValue(ESCAPEPROCESSING, escape);
final String queryCommand = (String) prop.getPropertyValue(UNO_COMMAND);
diff --git a/reportbuilder/java/org/libreoffice/report/SOImageService.java b/reportbuilder/java/org/libreoffice/report/SOImageService.java
index 7cc987145a6c..0ad67f6f526f 100644
--- a/reportbuilder/java/org/libreoffice/report/SOImageService.java
+++ b/reportbuilder/java/org/libreoffice/report/SOImageService.java
@@ -55,7 +55,7 @@ public class SOImageService implements ImageService
final XMultiComponentFactory m_xMCF = xCompContext.getServiceManager();
- m_xGraphicProvider = (XGraphicProvider) UnoRuntime.queryInterface(XGraphicProvider.class,
+ m_xGraphicProvider = UnoRuntime.queryInterface(XGraphicProvider.class,
m_xMCF.createInstanceWithContext("com.sun.star.graphic.GraphicProvider", xCompContext));
if (m_xGraphicProvider == null)
@@ -81,7 +81,7 @@ public class SOImageService implements ImageService
value[0].Name = "InputStream";
value[0].Value = image;
- final XPropertySet xImage = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,
+ final XPropertySet xImage = UnoRuntime.queryInterface(XPropertySet.class,
m_xGraphicProvider.queryGraphic(value));
if (xImage != null)
@@ -134,7 +134,7 @@ public class SOImageService implements ImageService
value[0].Name = "InputStream";
value[0].Value = image;
- final XPropertySet xImage = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,
+ final XPropertySet xImage = UnoRuntime.queryInterface(XPropertySet.class,
m_xGraphicProvider.queryGraphic(value));
if (xImage != null)
diff --git a/reportbuilder/java/org/libreoffice/report/StorageRepository.java b/reportbuilder/java/org/libreoffice/report/StorageRepository.java
index 2feb9972b118..ef5c12b025a0 100644
--- a/reportbuilder/java/org/libreoffice/report/StorageRepository.java
+++ b/reportbuilder/java/org/libreoffice/report/StorageRepository.java
@@ -91,7 +91,7 @@ public class StorageRepository implements InputRepository, OutputRepository
}
try
{
- final XStream xStream = (XStream) UnoRuntime.queryInterface(XStream.class, input.openStreamElement(name, ElementModes.READ));
+ final XStream xStream = UnoRuntime.queryInterface(XStream.class, input.openStreamElement(name, ElementModes.READ));
return new BufferedInputStream(new XInputStreamToInputStreamAdapter(xStream.getInputStream()), 102400);
}
catch (com.sun.star.uno.Exception e)
@@ -121,7 +121,7 @@ public class StorageRepository implements InputRepository, OutputRepository
stream.getInputStream().closeInput();
if (mimeType != null)
{
- final XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, stream);
+ final XPropertySet prop = UnoRuntime.queryInterface(XPropertySet.class, stream);
prop.setPropertyValue("MediaType", mimeType);
}
return new BufferedOutputStream(new XOutputStreamToOutputStreamAdapter(stream.getOutputStream()), 204800);
@@ -201,7 +201,7 @@ public class StorageRepository implements InputRepository, OutputRepository
{
throw new IOException();
}
- final XStorage storage = (XStorage) UnoRuntime.queryInterface(XStorage.class, input.openStorageElement(temp, ElementModes.READ));
+ final XStorage storage = UnoRuntime.queryInterface(XStorage.class, input.openStorageElement(temp, ElementModes.READ));
return new StorageRepository(storage, false, rootURL);
}
catch (NoSuchElementException ex)
@@ -246,10 +246,10 @@ public class StorageRepository implements InputRepository, OutputRepository
try
{
final String temp = shortenName(name);
- final XStorage storage = (XStorage) UnoRuntime.queryInterface(XStorage.class, output.openStorageElement(temp, ElementModes.WRITE));
+ final XStorage storage = UnoRuntime.queryInterface(XStorage.class, output.openStorageElement(temp, ElementModes.WRITE));
if (mimeType != null)
{
- final XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, storage);
+ final XPropertySet prop = UnoRuntime.queryInterface(XPropertySet.class, storage);
prop.setPropertyValue("MediaType", mimeType);
}
return new StorageRepository(storage, true, rootURL);
@@ -296,7 +296,7 @@ public class StorageRepository implements InputRepository, OutputRepository
{
try
{
- final XTransactedObject obj = (XTransactedObject) UnoRuntime.queryInterface(XTransactedObject.class, output);
+ final XTransactedObject obj = UnoRuntime.queryInterface(XTransactedObject.class, output);
if (obj != null)
{
obj.commit();
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/SOFormulaParser.java b/reportbuilder/java/org/libreoffice/report/pentaho/SOFormulaParser.java
index f604210ffb67..fa827cc94699 100644
--- a/reportbuilder/java/org/libreoffice/report/pentaho/SOFormulaParser.java
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/SOFormulaParser.java
@@ -89,7 +89,7 @@ public final class SOFormulaParser extends ComponentBase
parser = new FormulaParser();
try
{
- final XFormulaOpCodeMapper mapper = (XFormulaOpCodeMapper) UnoRuntime.queryInterface(XFormulaOpCodeMapper.class, m_xContext.getServiceManager().createInstanceWithContext("simple.formula.FormulaOpCodeMapperObj", m_xContext));
+ final XFormulaOpCodeMapper mapper = UnoRuntime.queryInterface(XFormulaOpCodeMapper.class, m_xContext.getServiceManager().createInstanceWithContext("simple.formula.FormulaOpCodeMapperObj", m_xContext));
FormulaOpCodeMapEntry[] opCodes = mapper.getAvailableMappings(FormulaLanguage.ODFF, FormulaMapGroup.FUNCTIONS);
final DefaultFormulaContext defaultContext = new DefaultFormulaContext();
final FunctionRegistry functionRegistry = defaultContext.getFunctionRegistry();
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java b/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java
index 8d99ddf8b652..998ee84d5cc1 100644
--- a/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java
@@ -198,7 +198,7 @@ public class SOReportJobFactory
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
try
{
- final XSimpleRegistry simpleReg = (XSimpleRegistry) UnoRuntime.queryInterface(XSimpleRegistry.class,
+ final XSimpleRegistry simpleReg = UnoRuntime.queryInterface(XSimpleRegistry.class,
m_cmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.configuration.ConfigurationRegistry", m_cmpCtx));
String currentLocale = getLocaleFromRegistry(simpleReg, "org.openoffice.Setup", "L10N/ooSetupSystemLocale");
@@ -244,23 +244,23 @@ public class SOReportJobFactory
final NamedValue aProps = namedValue[i];
if ("ActiveConnection".equalsIgnoreCase(aProps.Name))
{
- activeConnection = (XConnection) UnoRuntime.queryInterface(XConnection.class, aProps.Value);
+ activeConnection = UnoRuntime.queryInterface(XConnection.class, aProps.Value);
}
else if ("ReportDefinition".equalsIgnoreCase(aProps.Name))
{
- report = (XReportDefinition) UnoRuntime.queryInterface(XReportDefinition.class, aProps.Value);
+ report = UnoRuntime.queryInterface(XReportDefinition.class, aProps.Value);
}
else if ("InputStorage".equalsIgnoreCase(aProps.Name))
{
- input = (XStorage) UnoRuntime.queryInterface(XStorage.class, aProps.Value);
+ input = UnoRuntime.queryInterface(XStorage.class, aProps.Value);
}
else if ("OutputStorage".equalsIgnoreCase(aProps.Name))
{
- output = (XStorage) UnoRuntime.queryInterface(XStorage.class, aProps.Value);
+ output = UnoRuntime.queryInterface(XStorage.class, aProps.Value);
}
else if ("RowSet".equalsIgnoreCase(aProps.Name))
{
- rowSet = (XRowSet) UnoRuntime.queryInterface(XRowSet.class, aProps.Value);
+ rowSet = UnoRuntime.queryInterface(XRowSet.class, aProps.Value);
}
else if ("mimetype".equalsIgnoreCase(aProps.Name))
{
@@ -295,12 +295,12 @@ public class SOReportJobFactory
}
else
{
- final XPropertySet set = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, rowSet);
+ final XPropertySet set = UnoRuntime.queryInterface(XPropertySet.class, rowSet);
if (set == null)
{
throw new com.sun.star.lang.IllegalArgumentException();
}
- activeConnection = (XConnection) UnoRuntime.queryInterface(XConnection.class, set.getPropertyValue("ActiveConnection"));
+ activeConnection = UnoRuntime.queryInterface(XConnection.class, set.getPropertyValue("ActiveConnection"));
}
if (mimetype == null)
{