From 19206458555de6c1043aef8ead96067c3d8bca4d Mon Sep 17 00:00:00 2001 From: Robert Antoni Buj i Gelonch Date: Fri, 19 Sep 2014 12:22:32 +0200 Subject: javaunohelper: use HashMap instead of Hashtable Collection Change-Id: I04e3245342a83df762fbec35a1523021a021f896 Reviewed-on: https://gerrit.libreoffice.org/11547 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- .../com/sun/star/comp/helper/Bootstrap.java | 20 +++++++++++--------- .../com/sun/star/comp/helper/ComponentContext.java | 12 +++++++----- 2 files changed, 18 insertions(+), 14 deletions(-) (limited to 'javaunohelper/com/sun/star/comp') diff --git a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java index 7b466b011c52..80daf4b27d0d 100644 --- a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java +++ b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java @@ -38,7 +38,9 @@ import java.io.File; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintStream; +import java.util.HashMap; import java.util.Hashtable; +import java.util.Map; import java.util.Random; /** Bootstrap offers functionality to obtain a context or simply @@ -94,7 +96,7 @@ public class Bootstrap { static public XComponentContext createInitialComponentContext( Hashtable context_entries ) throws Exception { - return createInitialComponentContext((java.util.Map)context_entries); + return createInitialComponentContext((Map) context_entries); } /** Bootstraps an initial component context with service manager and basic jurt components inserted. @@ -102,7 +104,7 @@ public class Bootstrap { context entries (type class ComponentContextEntry). @return a new context. */ - static public XComponentContext createInitialComponentContext( java.util.Map context_entries ) + static public XComponentContext createInitialComponentContext( Map context_entries ) throws Exception { ServiceManager xSMgr = new ServiceManager(); @@ -116,7 +118,7 @@ public class Bootstrap { // initial component context if (context_entries == null) - context_entries = new Hashtable( 1 ); + context_entries = new HashMap( 1 ); // add smgr context_entries.put( "/singletons/com.sun.star.lang.theServiceManager", @@ -143,7 +145,7 @@ public class Bootstrap { static public XMultiServiceFactory createSimpleServiceManager() throws Exception { return UnoRuntime.queryInterface( - XMultiServiceFactory.class, createInitialComponentContext( null ).getServiceManager() ); + XMultiServiceFactory.class, createInitialComponentContext( (Map) null ).getServiceManager() ); } @@ -155,7 +157,7 @@ public class Bootstrap { static public final XComponentContext defaultBootstrap_InitialComponentContext() throws Exception { - return defaultBootstrap_InitialComponentContext( null, null ); + return defaultBootstrap_InitialComponentContext( (String) null, (Map) null ); } /** * Backwards compatibility stub. @@ -164,7 +166,7 @@ public class Bootstrap { String ini_file, Hashtable bootstrap_parameters ) throws Exception { - return defaultBootstrap_InitialComponentContext(ini_file, (java.util.Map)bootstrap_parameters); + return defaultBootstrap_InitialComponentContext(ini_file, (Map) bootstrap_parameters); } /** Bootstraps the initial component context from a native UNO installation. @@ -178,7 +180,7 @@ public class Bootstrap { bootstrap parameters (maybe null) */ static public final XComponentContext defaultBootstrap_InitialComponentContext( - String ini_file, java.util.Map bootstrap_parameters ) + String ini_file, Map bootstrap_parameters ) throws Exception { // jni convenience: easier to iterate over array than calling Hashtable @@ -187,7 +189,7 @@ public class Bootstrap { { pairs = new String [ 2 * bootstrap_parameters.size() ]; int n = 0; - for (java.util.Map.Entry bootstrap_parameter : bootstrap_parameters.entrySet()) { + for (Map.Entry bootstrap_parameter : bootstrap_parameters.entrySet()) { pairs[ n++ ] = bootstrap_parameter.getKey(); pairs[ n++ ] = bootstrap_parameter.getValue(); } @@ -250,7 +252,7 @@ public class Bootstrap { try { // create default local component context XComponentContext xLocalContext = - createInitialComponentContext( null ); + createInitialComponentContext( (Map) null ); if ( xLocalContext == null ) throw new BootstrapException( "no local component context!" ); diff --git a/javaunohelper/com/sun/star/comp/helper/ComponentContext.java b/javaunohelper/com/sun/star/comp/helper/ComponentContext.java index 6f2d46ab38df..563c0a92d412 100644 --- a/javaunohelper/com/sun/star/comp/helper/ComponentContext.java +++ b/javaunohelper/com/sun/star/comp/helper/ComponentContext.java @@ -28,8 +28,10 @@ import com.sun.star.lang.XComponent; import com.sun.star.lang.XEventListener; import com.sun.star.lang.EventObject; -import java.util.Hashtable; import java.util.ArrayList; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; @@ -57,7 +59,7 @@ public class ComponentContext implements XComponentContext, XComponent private static final String SMGR_NAME = "/singletons/com.sun.star.lang.theServiceManager"; private static final String TDMGR_NAME = "/singletons/com.sun.star.reflection.theTypeDescriptionManager"; - private java.util.Map m_table; + private Map m_table; private XComponentContext m_xDelegate; private XMultiComponentFactory m_xSMgr; @@ -67,7 +69,7 @@ public class ComponentContext implements XComponentContext, XComponent public ComponentContext( Hashtable table, XComponentContext xDelegate ) { - this((java.util.Map)table, xDelegate); + this((Map) table, xDelegate); } /** Ctor to create a component context passing a hashtable for values and a delegator @@ -79,7 +81,7 @@ public class ComponentContext implements XComponentContext, XComponent @param xDelegate if values are not found, request is delegated to this object */ - public ComponentContext( java.util.Map table, XComponentContext xDelegate ) + public ComponentContext( Map table, XComponentContext xDelegate ) { m_eventListener = new ArrayList(); m_table = table; @@ -237,7 +239,7 @@ public class ComponentContext implements XComponentContext, XComponent XComponent tdmgr = null; // dispose values, then service manager, then typdescription manager - for (java.util.Map.Entry entry : m_table.entrySet()) + for (Map.Entry entry : m_table.entrySet()) { String name = entry.getKey(); if (! name.equals( SMGR_NAME )) -- cgit