diff options
author | Noel Grandin <noel@peralex.com> | 2014-11-26 10:51:57 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-11-27 09:27:05 +0200 |
commit | d4daa09f94085a0fb11f4574756929418a48bf48 (patch) | |
tree | 4aa02c3f262e90b327654329b792279a7d1c07d1 /wizards/com/sun/star/wizards/db | |
parent | c0d1f38fb4de1bfa3eea0501e36e85e8dd3a0269 (diff) |
java,wizards: remove unnecessary use of reflection
Change-Id: I44750fa6673c7b5e0a796b6e443028aa3a5e68fc
Diffstat (limited to 'wizards/com/sun/star/wizards/db')
-rw-r--r-- | wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java b/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java index ca0ec1f5e6af..013fb547ca2b 100644 --- a/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java +++ b/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java @@ -31,8 +31,6 @@ import com.sun.star.wizards.common.Desktop; import com.sun.star.wizards.common.NamedValueCollection; import com.sun.star.wizards.common.Properties; import com.sun.star.wizards.ui.WizardDialog; -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; import java.util.logging.Level; import java.util.logging.Logger; @@ -89,7 +87,12 @@ public abstract class DatabaseObjectWizard extends WizardDialog } } - protected static void executeWizardFromCommandLine( final String i_args[], final String i_className ) + public interface WizardFromCommandLineStarter + { + void start(XMultiServiceFactory factory, PropertyValue[] curproperties); + } + + protected static void executeWizardFromCommandLine( final String i_args[], WizardFromCommandLineStarter starter ) { final String settings[] = new String[] { null, null, null }; final int IDX_PIPE_NAME = 0; @@ -156,11 +159,7 @@ public abstract class DatabaseObjectWizard extends WizardDialog else curproperties[0] = Properties.createProperty( "DataSourceName", settings[ IDX_DSN ] ); - final Class wizardClass = Class.forName( i_className ); - final Constructor ctor = wizardClass.getConstructor( XMultiServiceFactory.class, PropertyValue[].class ); - final Method invokeMethod = wizardClass.getMethod( "start", new Class[0] ); - final Object wizardInstance = ctor.newInstance( serviceFactory, curproperties ); - invokeMethod.invoke( wizardInstance ); + starter.start(serviceFactory, curproperties); } } catch (java.lang.Exception jexception) |