From be1bb7b1ccee28be616b89cc95e97d656e78bbe3 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 12 Aug 2014 14:00:54 +0200 Subject: java: use Boolean.valueOf instead of instantiating Boolean objects Change-Id: Ie41d6b0170a035a694dd270c311a137fd1810e74 --- odk/examples/java/ConverterServlet/ConverterServlet.java | 4 ++-- odk/examples/java/DocumentHandling/DocumentConverter.java | 4 ++-- odk/examples/java/DocumentHandling/DocumentSaver.java | 4 ++-- odk/examples/java/Drawing/SDraw.java | 2 +- odk/examples/java/EmbedDocument/Container1/EmbedContApp.java | 2 +- odk/examples/java/Spreadsheet/ChartTypeChange.java | 2 +- odk/examples/java/Spreadsheet/SCalc.java | 6 +++--- odk/examples/java/Storage/TestHelper.java | 6 +++--- odk/examples/java/Text/BookmarkInsertion.java | 2 +- odk/examples/java/Text/SWriter.java | 8 ++++---- odk/examples/java/Text/StyleCreation.java | 2 +- 11 files changed, 21 insertions(+), 21 deletions(-) (limited to 'odk/examples/java') diff --git a/odk/examples/java/ConverterServlet/ConverterServlet.java b/odk/examples/java/ConverterServlet/ConverterServlet.java index be1b5cbc4ea2..379d75814dba 100644 --- a/odk/examples/java/ConverterServlet/ConverterServlet.java +++ b/odk/examples/java/ConverterServlet/ConverterServlet.java @@ -265,7 +265,7 @@ public class ConverterServlet extends HttpServlet { // Setting the flag for hidding the open document propertyvalue[ 0 ] = new PropertyValue(); propertyvalue[ 0 ].Name = "Hidden"; - propertyvalue[ 0 ].Value = new Boolean(true); + propertyvalue[ 0 ].Value = Boolean.TRUE; // Loading the wanted document Object objectDocumentToStore = @@ -282,7 +282,7 @@ public class ConverterServlet extends HttpServlet { // Setting the flag for overwriting propertyvalue[ 0 ] = new PropertyValue(); propertyvalue[ 0 ].Name = "Overwrite"; - propertyvalue[ 0 ].Value = new Boolean(true); + propertyvalue[ 0 ].Value = Boolean.TRUE; // Setting the filter name propertyvalue[ 1 ] = new PropertyValue(); propertyvalue[ 1 ].Name = "FilterName"; diff --git a/odk/examples/java/DocumentHandling/DocumentConverter.java b/odk/examples/java/DocumentHandling/DocumentConverter.java index aeb6f022d2ca..35002fb5de1b 100644 --- a/odk/examples/java/DocumentHandling/DocumentConverter.java +++ b/odk/examples/java/DocumentHandling/DocumentConverter.java @@ -103,7 +103,7 @@ public class DocumentConverter { new com.sun.star.beans.PropertyValue[1]; propertyValues[0] = new com.sun.star.beans.PropertyValue(); propertyValues[0].Name = "Hidden"; - propertyValues[0].Value = new Boolean(true); + propertyValues[0].Value = Boolean.TRUE; Object oDocToStore = DocumentConverter.xCompLoader.loadComponentFromURL( @@ -120,7 +120,7 @@ public class DocumentConverter { // Setting the flag for overwriting propertyValues[0] = new com.sun.star.beans.PropertyValue(); propertyValues[0].Name = "Overwrite"; - propertyValues[0].Value = new Boolean(true); + propertyValues[0].Value = Boolean.TRUE; // Setting the filter name propertyValues[1] = new com.sun.star.beans.PropertyValue(); propertyValues[1].Name = "FilterName"; diff --git a/odk/examples/java/DocumentHandling/DocumentSaver.java b/odk/examples/java/DocumentHandling/DocumentSaver.java index 052b344a3d2e..42a99e91b5c9 100644 --- a/odk/examples/java/DocumentHandling/DocumentSaver.java +++ b/odk/examples/java/DocumentHandling/DocumentSaver.java @@ -86,7 +86,7 @@ public class DocumentSaver { new com.sun.star.beans.PropertyValue[1]; propertyValue[0] = new com.sun.star.beans.PropertyValue(); propertyValue[0].Name = "Hidden"; - propertyValue[0].Value = new Boolean(true); + propertyValue[0].Value = Boolean.TRUE; Object oDocToStore = xCompLoader.loadComponentFromURL( sLoadUrl.toString(), "_blank", 0, propertyValue ); @@ -97,7 +97,7 @@ public class DocumentSaver { propertyValue = new com.sun.star.beans.PropertyValue[ 2 ]; propertyValue[0] = new com.sun.star.beans.PropertyValue(); propertyValue[0].Name = "Overwrite"; - propertyValue[0].Value = new Boolean(true); + propertyValue[0].Value = Boolean.TRUE; propertyValue[1] = new com.sun.star.beans.PropertyValue(); propertyValue[1].Name = "FilterName"; propertyValue[1].Value = "StarOffice XML (Writer)"; diff --git a/odk/examples/java/Drawing/SDraw.java b/odk/examples/java/Drawing/SDraw.java index a70a9288e01f..54404e244de6 100644 --- a/odk/examples/java/Drawing/SDraw.java +++ b/odk/examples/java/Drawing/SDraw.java @@ -238,7 +238,7 @@ public class SDraw { try { xSPS.setPropertyValue("FillColor", new Integer(getCol(r,g,b))); - xSPS.setPropertyValue("Shadow", new Boolean(true)); + xSPS.setPropertyValue("Shadow", Boolean.TRUE); } catch (Exception e) { System.err.println("Can't change colors " + e); e.printStackTrace(System.err); diff --git a/odk/examples/java/EmbedDocument/Container1/EmbedContApp.java b/odk/examples/java/EmbedDocument/Container1/EmbedContApp.java index fad4b844466a..d419063b6879 100644 --- a/odk/examples/java/EmbedDocument/Container1/EmbedContApp.java +++ b/odk/examples/java/EmbedDocument/Container1/EmbedContApp.java @@ -795,7 +795,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie aMedDescr[0].Name = "URL"; aMedDescr[0].Value = (Object) aFileURI; aMedDescr[1].Name = "ReadOnly"; - aMedDescr[1].Value = (Object) new Boolean( false ); + aMedDescr[1].Value = (Object) Boolean.FALSE; Object oEmbObj = xEmbedFactory.createInstanceInitFromMediaDescriptor( m_xStorage, "EmbedSub", aMedDescr ); diff --git a/odk/examples/java/Spreadsheet/ChartTypeChange.java b/odk/examples/java/Spreadsheet/ChartTypeChange.java index 20fbfadb971b..271433890617 100644 --- a/odk/examples/java/Spreadsheet/ChartTypeChange.java +++ b/odk/examples/java/Spreadsheet/ChartTypeChange.java @@ -162,7 +162,7 @@ public class ChartTypeChange { XPropertySet xPropSet = UnoRuntime.queryInterface( XPropertySet.class, xDiagram ); - xPropSet.setPropertyValue( "Dim3D", new Boolean( booleanIs3D ) ); + xPropSet.setPropertyValue( "Dim3D", Boolean.valueOf( booleanIs3D ) ); xChartDoc.setDiagram(xDiagram); } diff --git a/odk/examples/java/Spreadsheet/SCalc.java b/odk/examples/java/Spreadsheet/SCalc.java index 8f4e1d98982c..a303fafabc65 100644 --- a/odk/examples/java/Spreadsheet/SCalc.java +++ b/odk/examples/java/Spreadsheet/SCalc.java @@ -138,7 +138,7 @@ public class SCalc { oStyleFamilyNameContainer.insertByName("My Style", oInt1); XPropertySet oCPS1 = UnoRuntime.queryInterface( XPropertySet.class, oInt1 ); - oCPS1.setPropertyValue("IsCellBackgroundTransparent", new Boolean(false)); + oCPS1.setPropertyValue("IsCellBackgroundTransparent", Boolean.FALSE); oCPS1.setPropertyValue("CellBackColor",new Integer(6710932)); oCPS1.setPropertyValue("CharColor",new Integer(16777215)); XInterface oInt2 = (XInterface) oDocMSF.createInstance( @@ -146,7 +146,7 @@ public class SCalc { oStyleFamilyNameContainer.insertByName("My Style2", oInt2); XPropertySet oCPS2 = UnoRuntime.queryInterface( XPropertySet.class, oInt2 ); - oCPS2.setPropertyValue("IsCellBackgroundTransparent", new Boolean(false)); + oCPS2.setPropertyValue("IsCellBackgroundTransparent", Boolean.FALSE); oCPS2.setPropertyValue("CellBackColor",new Integer(13421823)); } catch (Exception e) { e.printStackTrace(System.err); @@ -309,7 +309,7 @@ public class SCalc { System.out.println("Change Diagramm to 3D"); XPropertySet oCPS = UnoRuntime.queryInterface( XPropertySet.class, oDiag ); - oCPS.setPropertyValue("Dim3D", new Boolean(true)); + oCPS.setPropertyValue("Dim3D", Boolean.TRUE); System.out.println("Change the title"); Thread.sleep(200); XPropertySet oTPS = UnoRuntime.queryInterface( diff --git a/odk/examples/java/Storage/TestHelper.java b/odk/examples/java/Storage/TestHelper.java index 9fa2faff086d..3d95f7952203 100644 --- a/odk/examples/java/Storage/TestHelper.java +++ b/odk/examples/java/Storage/TestHelper.java @@ -80,7 +80,7 @@ public class TestHelper { try { xPropSet.setPropertyValue( "MediaType", sMediaType ); - xPropSet.setPropertyValue( "Compressed", new Boolean( bCompressed ) ); + xPropSet.setPropertyValue( "Compressed", Boolean.valueOf( bCompressed ) ); } catch( Exception e ) { @@ -208,7 +208,7 @@ public class TestHelper { // set properties to the stream try { - xPropSet.setPropertyValue( "Encrypted", new Boolean( bEncrypted ) ); + xPropSet.setPropertyValue( "Encrypted", Boolean.valueOf( bEncrypted ) ); } catch( Exception e ) { @@ -711,7 +711,7 @@ public class TestHelper { { try { - xTempFileProps.setPropertyValue( "RemoveFile", new Boolean( false ) ); + xTempFileProps.setPropertyValue( "RemoveFile", Boolean.FALSE ); sResult = AnyConverter.toString( xTempFileProps.getPropertyValue( "Uri" ) ); } catch( Exception e ) diff --git a/odk/examples/java/Text/BookmarkInsertion.java b/odk/examples/java/Text/BookmarkInsertion.java index bb5a44e3413c..3358e23ebcbb 100644 --- a/odk/examples/java/Text/BookmarkInsertion.java +++ b/odk/examples/java/Text/BookmarkInsertion.java @@ -160,7 +160,7 @@ public class BookmarkInsertion { com.sun.star.beans.XPropertySet.class, xSearchDescriptor); xPropertySet.setPropertyValue("SearchRegularExpression", - new Boolean( true ) ); + Boolean.TRUE ); xSearchInterface = (com.sun.star.uno.XInterface) xSearchable.findFirst(xSearchDescriptor); diff --git a/odk/examples/java/Text/SWriter.java b/odk/examples/java/Text/SWriter.java index d96c583ce6b5..393edc1c01d5 100644 --- a/odk/examples/java/Text/SWriter.java +++ b/odk/examples/java/Text/SWriter.java @@ -155,9 +155,9 @@ public class SWriter { // Change the BackColor try { - xTTPS.setPropertyValue("BackTransparent", new Boolean(false)); + xTTPS.setPropertyValue("BackTransparent", Boolean.FALSE); xTTPS.setPropertyValue("BackColor",new Integer(13421823)); - xTTRowPS.setPropertyValue("BackTransparent", new Boolean(false)); + xTTRowPS.setPropertyValue("BackTransparent", Boolean.FALSE); xTTRowPS.setPropertyValue("BackColor",new Integer(6710932)); } catch (Exception e) { @@ -206,7 +206,7 @@ public class SWriter { // Change the CharColor and add a Shadow try { xTCPS.setPropertyValue("CharColor",new Integer(255)); - xTCPS.setPropertyValue("CharShadowed", new Boolean(true)); + xTCPS.setPropertyValue("CharShadowed", Boolean.TRUE); } catch (Exception e) { System.err.println("Couldn't change the color " + e); e.printStackTrace(System.err); @@ -316,7 +316,7 @@ public class SWriter { // Change the CharColor and add a Shadow try { xTCPS.setPropertyValue("CharColor",new Integer(65536)); - xTCPS.setPropertyValue("CharShadowed", new Boolean(false)); + xTCPS.setPropertyValue("CharShadowed", Boolean.FALSE); } catch (Exception e) { System.err.println("Couldn't change the color " + e); e.printStackTrace(System.err); diff --git a/odk/examples/java/Text/StyleCreation.java b/odk/examples/java/Text/StyleCreation.java index a5ae0cc790f0..04207407c41d 100644 --- a/odk/examples/java/Text/StyleCreation.java +++ b/odk/examples/java/Text/StyleCreation.java @@ -99,7 +99,7 @@ public class StyleCreation { new Float( com.sun.star.awt.FontWeight.BOLD ) ); System.out.println( "set the font attribute 'Bold'" ); - xPropertySet.setPropertyValue("CharAutoKerning", new Boolean( true ) ); + xPropertySet.setPropertyValue("CharAutoKerning", Boolean.TRUE ); System.out.println( "set the paragraph attribute 'AutoKerning'" ); xPropertySet.setPropertyValue("ParaAdjust", new Integer( com.sun.star.style.ParagraphAdjust.CENTER_value ) ); -- cgit