Package java.lang.reflect

Examples of java.lang.reflect.Constructor.newInstance()


      if (preset != null)
        widgetConstructor = wClass.getConstructor(new Class[] { Widget.class, String.class, String.class });
      else
        widgetConstructor = wClass.getConstructor(new Class[] { Widget.class, String.class });
      if (preset != null)
        widget = (Widget) widgetConstructor.newInstance(new Object[] { parentWidget, widgetName, preset });
      else
        widget = (Widget) widgetConstructor.newInstance(new Object[] { parentWidget, widgetName });

      widget.setDataModel(debuggingMapDataModel);
View Full Code Here


      else
        widgetConstructor = wClass.getConstructor(new Class[] { Widget.class, String.class });
      if (preset != null)
        widget = (Widget) widgetConstructor.newInstance(new Object[] { parentWidget, widgetName, preset });
      else
        widget = (Widget) widgetConstructor.newInstance(new Object[] { parentWidget, widgetName });

      widget.setDataModel(debuggingMapDataModel);

      return widget;
    } catch (ClassNotFoundException e) {
View Full Code Here

            break;
        case MRJ_3_0:
            try {
                Class linker = Class.forName("com.apple.mrj.jdirect.Linker");
                Constructor constructor = linker.getConstructor(new Class[]{ Class.class });
                /*linkage = */constructor.newInstance(new Object[] { BrowserLauncher.class });
            } catch (ClassNotFoundException cnfe) {
                errorMessage = cnfe.getMessage();
                return false;
            } catch (NoSuchMethodException nsme) {
                errorMessage = nsme.getMessage();
View Full Code Here

    private static transient ReflectionFactory reflectionFactory = ReflectionFactory.getReflectionFactory();
    private static transient Map constructorCache = Collections.synchronizedMap(new HashMap());

    public static Object newInstance(Class type) throws Exception {
        Constructor customConstructor = getMungedConstructor(type);
        return customConstructor.newInstance(new Object[0]);
    }

    private static Constructor getMungedConstructor(Class type) throws NoSuchMethodException {
        if (!constructorCache.containsKey(type)) {
            Constructor javaLangObjectConstructor = Object.class.getDeclaredConstructor(new Class[0]);
View Full Code Here

    Object [] args = { path, configObj };
    Constructor constructor = crDsClass.getDeclaredConstructor( argTypes );

    try
    {
      return (CrawlableDataset) constructor.newInstance( args );
    }
    catch ( InvocationTargetException e )
    {
      if ( IOException.class.isAssignableFrom( e.getCause().getClass()) )
        throw (IOException) e.getCause();
View Full Code Here

            name = "org.jzonic.jlo.handler."+name;
        }
        try {
            Class c = Class.forName(name);
            Constructor con = c.getDeclaredConstructor(new Class[]{String.class});
            Handler hndl = (Handler)con.newInstance(new Object[]{new String(configurationName)});
            return hndl;
        } catch (Exception e) {
            ErrorHandler.reportError("Exception while instantiating the handler: " + name,e);
            return new ConsoleHandler("Default");
        }
View Full Code Here

    }
    try {
  // now we instantiate the formatter
        Class c = Class.forName(name);
        Constructor con = c.getDeclaredConstructor(new Class[]{String.class});
        Formatter fmt = (Formatter)con.newInstance(new Object[]{new String(configurationName)});               
        return fmt;
    } catch (Exception e) {
  // something went wrong and we send it to the ErrorHandler
        ErrorHandler.reportError("Exception while instantiating the formatter: " + name, e);
        return new SimpleFormatter("Default");
View Full Code Here

    {
      try
      {
        Class saveContribClass = JRClassLoader.loadClassForName(DEFAULT_CONTRIBUTORS[i]);
        Constructor constructor = saveContribClass.getConstructor(new Class[]{Locale.class, ResourceBundle.class});
        JRSaveContributor saveContrib = (JRSaveContributor)constructor.newInstance(new Object[]{getLocale(), viewerContext.getResourceBundle()});
        saveContributors.add(saveContrib);
      }
      catch (Exception e)
      {
      }
View Full Code Here

               final Constructor constructor = startupClass.getConstructor(null);
       
                //constructor.newInstance(new Object[] {
                //           args
                //});
               constructor.newInstance(null);

          } catch (Throwable cause) {
         
               if( cause instanceof ClassNotFoundException ) {
                
View Full Code Here

        break;
      case MRJ_3_0:
        try {
          Class linker = Class.forName("com.apple.mrj.jdirect.Linker");
          Constructor constructor = linker.getConstructor(new Class[]{ Class.class });
          linkage = constructor.newInstance(new Object[] { BrowserLauncher.class });
        } catch (ClassNotFoundException cnfe) {
          errorMessage = cnfe.getMessage();
          return false;
        } catch (NoSuchMethodException nsme) {
          errorMessage = nsme.getMessage();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.