[Libreoffice-commits] core.git: javaunohelper/com javaunohelper/test
Robert Antoni Buj i Gelonch
robert.buj at gmail.com
Fri Sep 19 06:50:54 PDT 2014
javaunohelper/com/sun/star/comp/helper/Bootstrap.java | 20 +++++-----
javaunohelper/com/sun/star/comp/helper/ComponentContext.java | 12 +++---
javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java | 3 +
3 files changed, 20 insertions(+), 15 deletions(-)
New commits:
commit 19206458555de6c1043aef8ead96067c3d8bca4d
Author: Robert Antoni Buj i Gelonch <robert.buj at gmail.com>
Date: Fri Sep 19 12:22:32 2014 +0200
javaunohelper: use HashMap instead of Hashtable Collection
Change-Id: I04e3245342a83df762fbec35a1523021a021f896
Reviewed-on: https://gerrit.libreoffice.org/11547
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
Tested-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java
index 7b466b0..80daf4b 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<String, Object> context_entries )
throws Exception
{
- return createInitialComponentContext((java.util.Map<String,Object>)context_entries);
+ return createInitialComponentContext((Map<String, Object>) 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<String, Object> context_entries )
+ static public XComponentContext createInitialComponentContext( Map<String, Object> 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<String,Object>( 1 );
+ context_entries = new HashMap<String,Object>( 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<String, Object>) 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<String,String>) null );
}
/**
* Backwards compatibility stub.
@@ -164,7 +166,7 @@ public class Bootstrap {
String ini_file, Hashtable<String,String> bootstrap_parameters )
throws Exception
{
- return defaultBootstrap_InitialComponentContext(ini_file, (java.util.Map<String,String>)bootstrap_parameters);
+ return defaultBootstrap_InitialComponentContext(ini_file, (Map<String,String>) 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<String,String> bootstrap_parameters )
+ String ini_file, Map<String,String> 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<String, String> bootstrap_parameter : bootstrap_parameters.entrySet()) {
+ for (Map.Entry<String, String> 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<String, Object>) 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 6f2d46a..563c0a9 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<String,Object> m_table;
+ private Map<String,Object> m_table;
private XComponentContext m_xDelegate;
private XMultiComponentFactory m_xSMgr;
@@ -67,7 +69,7 @@ public class ComponentContext implements XComponentContext, XComponent
public ComponentContext( Hashtable<String,Object> table, XComponentContext xDelegate )
{
- this((java.util.Map<String,Object>)table, xDelegate);
+ this((Map<String,Object>) 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<String,Object> table, XComponentContext xDelegate )
+ public ComponentContext( Map<String,Object> table, XComponentContext xDelegate )
{
m_eventListener = new ArrayList<XEventListener>();
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<String, Object> entry : m_table.entrySet())
+ for (Map.Entry<String, Object> entry : m_table.entrySet())
{
String name = entry.getKey();
if (! name.equals( SMGR_NAME ))
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 fc7640e..57724be 100644
--- a/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java
+++ b/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java
@@ -25,10 +25,11 @@ import com.sun.star.uno.XComponentContext;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
+import java.util.Map;
public class Bootstrap_Test {
- static public boolean test( String ini_file, java.util.Map<String,String> bootstrap_parameters )
+ static public boolean test( String ini_file, Map<String,String> bootstrap_parameters )
throws java.lang.Exception
{
boolean passed = false;
More information about the Libreoffice-commits
mailing list