Package java.lang.reflect

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


            }
        }
        try {
            Class<?> pc = ProxyCodeGenerator.getClassProxy(c);
            Constructor cons = pc.getConstructor(new Class<?>[] { InvocationHandler.class });
            return (T) cons.newInstance(new Object[] { ih });
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here


                String classname=props.getProperty(filePersistMgr);
                if(classname != null)
                {
                    Class cl=Util.loadClass(classname, this.getClass());
                    Constructor ctor=cl.getConstructor(new Class[]{String.class});
                    _manager=(PersistenceManager)ctor.newInstance(new Object[]{filePath});
                }
                else
                {
                    _manager = new FilePersistenceManager(filePath);
                }
View Full Code Here

                // need an InetSocketAddress instance for connect()
                Class inetSocketAddress = Class.forName("java.net.InetSocketAddress");
                Constructor inetSocketAddressCtr =
                    inetSocketAddress.getConstructor(
                            new Class[] { InetAddress.class, int.class });
                Object address = inetSocketAddressCtr.newInstance(
                        new Object[] { host, new Integer(port) });

                // now invoke the connect method with the timeout
                log.debug("Invoking connect with timeout=" + timeout);
                connectMethod.invoke(sock, new Object[]{address, new Integer(timeout)});
View Full Code Here

                for (int i=0; i<argsTypes.length; i++) {
                    argsTypes[i] = args[i] == null ? null : args[i].getClass();
                }
                Constructor cnst = clazz.getConstructor(argsTypes);
                // crate a new instance using the constructor
                Object obj = cnst.newInstance(args);
                return Context.toObject(obj, core.global);
            } catch (Exception x) {
                System.err.println("Error in Java constructor: "+x);
                throw new EvaluatorException(x.toString());
            }
View Full Code Here

        if (!clazz.isInterface()) {
            try {
                Constructor c = clazz.getDeclaredConstructor(new Class[] {});
                if (c != null) {
                  try {
                    return c.newInstance(new Object[] {});
                  } catch (InvocationTargetException e) {
                    throw e.getTargetException();
                  }
                }
            } catch (NoSuchMethodException e) {
View Full Code Here

       
        // create a MainWindow regardless to the server state
       
      AzureusCore    core = AzureusCoreFactory.create();

        constructor.newInstance(new Object[] {
          core,
          startServer,
          args
        });
View Full Code Here

 
        AzureusCore    core = AzureusCoreFactory.create();
       
        startServer.pollForConnections(core);
 
        constructor.newInstance(new Object[] {
          core,
          startServer,
          args
        });
       
View Full Code Here

        try {
          Constructor constructor = info.cla.getDeclaredConstructor(new Class[] {
            String.class
          });
          TableColumnCore column = (TableColumnCore) constructor.newInstance(new Object[] {
            tableID
          });
          return column;
        } catch (Exception e) {
          Debug.out(e);
View Full Code Here

    try {

      final Constructor constructor = uiswClass.getConstructor(new Class[] {});

      Object object = constructor.newInstance(new Object[] {});

      Method method = uiswClass.getMethod("open", new Class[] {});

      method.invoke(object, new Object[] {});
View Full Code Here

      }
      if (commands.hasOption('e')) {
        if (conConsoleInput != null) {
          try {
            Object params[] = {commands.getOptionValue('e'), new_core, new FileReader(commands.getOptionValue('e')), System.out, Boolean.FALSE};
            conConsoleInput.newInstance(params);
          } catch (java.io.FileNotFoundException e) {
            Logger.getLogger("azureus2").error("Script file not found: "+e.toString());
          } catch (Exception e) {
            Logger.getLogger("azureus2").error("Error invocating the script processor: "+e.toString());
          }
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.