diff options
author | Noel Grandin <noel@peralex.com> | 2013-05-03 15:03:19 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-05-06 11:45:53 +0200 |
commit | 8be40d31d78723debd47f671544f480c1c606db7 (patch) | |
tree | 0051888bb41793e4d65704a93a4cfc659119c8bc /javaunohelper | |
parent | e527a340051b55a6f05d05f397d82ec797165163 (diff) |
Java cleanup, convert Hashtable to HashMap
Change-Id: If8a9c0c3a4b357fb9c0ff096f44ed1b44ebbcef4
Diffstat (limited to 'javaunohelper')
4 files changed, 34 insertions, 14 deletions
diff --git a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java index 989e283853b0..85bc4837a99d 100644 --- a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java +++ b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java @@ -89,13 +89,21 @@ public class Bootstrap { "com.sun.star.comp.connections.Acceptor", null, null, null ) ); } + /** + * backwards compatibility stub. + */ + static public XComponentContext createInitialComponentContext( Hashtable<String, Object> context_entries ) + throws Exception + { + return createInitialComponentContext((java.util.Map<String,Object>)context_entries); + } /** Bootstraps an initial component context with service manager and basic jurt components inserted. @param context_entries the hash table contains mappings of entry names (type string) to context entries (type class ComponentContextEntry). @return a new context. */ - static public XComponentContext createInitialComponentContext( Hashtable<String, Object> context_entries ) + static public XComponentContext createInitialComponentContext( java.util.Map<String, Object> context_entries ) throws Exception { ServiceManager xSMgr = new ServiceManager(); @@ -148,6 +156,16 @@ public class Bootstrap { { return defaultBootstrap_InitialComponentContext( null, null ); } + /** + * Backwards compatibility stub. + */ + static public final XComponentContext defaultBootstrap_InitialComponentContext( + String ini_file, Hashtable<String,String> bootstrap_parameters ) + throws Exception + { + return defaultBootstrap_InitialComponentContext(ini_file, (java.util.Map<String,String>)bootstrap_parameters); + + } /** Bootstraps the initial component context from a native UNO installation. @param ini_file @@ -158,7 +176,7 @@ public class Bootstrap { @see "cppuhelper/defaultBootstrap_InitialComponentContext()" */ static public final XComponentContext defaultBootstrap_InitialComponentContext( - String ini_file, Hashtable<String,String> bootstrap_parameters ) + String ini_file, java.util.Map<String,String> bootstrap_parameters ) throws Exception { // jni convenience: easier to iterate over array than calling Hashtable diff --git a/javaunohelper/com/sun/star/comp/helper/ComponentContext.java b/javaunohelper/com/sun/star/comp/helper/ComponentContext.java index c47d623dcfa8..0b3b1948acd2 100644 --- a/javaunohelper/com/sun/star/comp/helper/ComponentContext.java +++ b/javaunohelper/com/sun/star/comp/helper/ComponentContext.java @@ -58,7 +58,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 Hashtable<String,Object> m_table; + private java.util.Map<String,Object> m_table; private XComponentContext m_xDelegate; private XMultiComponentFactory m_xSMgr; @@ -66,6 +66,11 @@ public class ComponentContext implements XComponentContext, XComponent private ArrayList<XEventListener> m_eventListener; + public ComponentContext( Hashtable<String,Object> table, XComponentContext xDelegate ) + { + this((java.util.Map<String,Object>)table, xDelegate); + } + /** Ctor to create a component context passing a hashtable for values and a delegator reference. Entries of the passed hashtable are either direct values or ComponentContextEntry objects. @@ -75,7 +80,7 @@ public class ComponentContext implements XComponentContext, XComponent @param xDelegate if values are not found, request is delegated to this object */ - public ComponentContext( Hashtable<String,Object> table, XComponentContext xDelegate ) + public ComponentContext( java.util.Map<String,Object> table, XComponentContext xDelegate ) { m_eventListener = new ArrayList<XEventListener>(); m_table = table; diff --git a/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java b/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java index 2a292be96b1a..8e8032f1addd 100644 --- a/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java +++ b/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java @@ -28,7 +28,7 @@ import com.sun.star.lang.XMultiServiceFactory; public class Bootstrap_Test { - static public boolean test( String ini_file, java.util.Hashtable<String,String> bootstrap_parameters ) + static public boolean test( String ini_file, java.util.Map<String,String> bootstrap_parameters ) throws java.lang.Exception { boolean passed = false; @@ -91,7 +91,7 @@ public class Bootstrap_Test { if ( args.length == 0 ) usage(); - java.util.Hashtable<String,String> bootstrap_parameters = new java.util.Hashtable<String,String>(); + java.util.HashMap<String,String> bootstrap_parameters = new java.util.HashMap<String,String>(); for ( int nPos = 1; nPos < args.length; ++nPos ) { String arg = args[ nPos ]; diff --git a/javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java b/javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java index 1a28a77f84f2..7847a86a26ec 100644 --- a/javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java +++ b/javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java @@ -17,25 +17,22 @@ */ package com.sun.star.comp.helper; -import com.sun.star.uno.XComponentContext; +import java.util.HashMap; + import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiComponentFactory; - -import com.sun.star.comp.helper.ComponentContext; -import com.sun.star.comp.helper.ComponentContextEntry; import com.sun.star.uno.UnoRuntime; - -import java.util.Hashtable; +import com.sun.star.uno.XComponentContext; public class ComponentContext_Test { public static void main(String args[]) { try { - Hashtable<String,Object> table = new Hashtable<String,Object>(); + HashMap<String,Object> table = new HashMap<String,Object>(); table.put( "bla1", new ComponentContextEntry( null, new Integer( 1 ) ) ); XComponentContext xInitialContext = Bootstrap.createInitialComponentContext( table ); - table = new Hashtable<String,Object>(); + table = new HashMap<String,Object>(); table.put( "bla2", new ComponentContextEntry( new Integer( 2 ) ) ); table.put( "bla3", new Integer( 3 ) ); XComponentContext xContext = new ComponentContext( table, xInitialContext ); |