Package java.lang.reflect

Examples of java.lang.reflect.Constructor$ConstructorData


      }

      final Constructor[] methods = c.getConstructors();
      for (int i = 0; i < methods.length; i++)
      {
        final Constructor method = methods[i];
        if (Modifier.isPublic(method.getModifiers()) == false)
        {
          continue;
        }
        if (method.getParameterTypes().length != paramCount)
        {
          continue;
        }
        return method;
      }
View Full Code Here


      }

      final Constructor[] methods = c.getConstructors();
      for (int i = 0; i < methods.length; i++)
      {
        final Constructor method = methods[i];
        if (Modifier.isPublic(method.getModifiers()) == false)
        {
          continue;
        }
        if (method.getParameterTypes().length != paramCount)
        {
          continue;
        }
        return method;
      }
View Full Code Here

        Class lnfClass = Class.forName(clazz);

        Method method = lnfClass.getMethod("setProperty", new Class[] { String.class, String.class });
        method.invoke(null, new Object[] { "alloy.licenseCode", licenseCode });

        Constructor constructor =
          lnfClass.getConstructor(new Class[] { Class.forName("com.incors.plaf.alloy.AlloyTheme")});
        LookAndFeel lnfInstance =
          (LookAndFeel) constructor.newInstance(new Object[] { Class.forName(themeClass).newInstance()});

        return lnfInstance;
      } catch (Exception e) {
        throw new GUIException("Error while setting theme", e);
      }
View Full Code Here

    throws GUIException {
    try {
      if (className.indexOf('.') == -1)
        className = WidgetFactory.DEFAULT_PREFIX + className;
      Class wClass = Class.forName(className);
      Constructor widgetConstructor = null;
      Widget widget = null;
      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);

      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]);
    }
View Full Code Here

        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]);
            Constructor customConstructor = reflectionFactory.newConstructorForSerialization(type, javaLangObjectConstructor);
            constructorCache.put(type, customConstructor);
        }
        return (Constructor) constructorCache.get(type);
    }
View Full Code Here

    }

    // Instantiate the desired CrawlableDataset.
    Class [] argTypes = { String.class, Object.class };
    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

        if ( name.indexOf("."== -1 ) {
            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

        name = "org.jzonic.jlo.formatter."+name;
    }
    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

TOP

Related Classes of java.lang.reflect.Constructor$ConstructorData

Copyright © 2018 www.massapicom. 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.