Package java.lang.reflect

Examples of java.lang.reflect.Constructor$ConstructorData


            } else {
                String clusterClassName = WebAppConfiguration.stringArg(args, "clusterClassName",
                        CLUSTER_CLASS).trim();
                try {
                    Class clusterClass = Class.forName(clusterClassName);
                    Constructor clusterConstructor = clusterClass
                            .getConstructor(new Class[] { Map.class, Integer.class });
                    this.cluster = (Cluster) clusterConstructor
                            .newInstance(new Object[] { args, new Integer(this.controlPort) });
                } catch (ClassNotFoundException err) {
                    Logger.log(Logger.DEBUG, RESOURCES, "Launcher.ClusterNotFound");
                } catch (Throwable err) {
                    Logger.log(Logger.WARNING, RESOURCES, "Launcher.ClusterStartupError", err);
                }
            }
        }
       
        // If jndi is enabled, run the container wide jndi populator
        if (useJNDI) {
            String jndiMgrClassName = WebAppConfiguration.stringArg(args, "containerJndiClassName",
                    DEFAULT_JNDI_MGR_CLASS).trim();
            try {
                // Build the realm
                Class jndiMgrClass = Class.forName(jndiMgrClassName, true, commonLibCL);
                Constructor jndiMgrConstr = jndiMgrClass.getConstructor(new Class[] {
                        Map.class, List.class, ClassLoader.class });
                this.globalJndiManager = (JNDIManager) jndiMgrConstr.newInstance(new Object[] {
                        args, null, commonLibCL });
                this.globalJndiManager.setup();
            } catch (ClassNotFoundException err) {
                Logger.log(Logger.DEBUG, RESOURCES,
                        "Launcher.JNDIDisabled");
View Full Code Here


     * catch and log any errors locally before rethrowing.
     */
    protected void spawnListener(String listenerClassName) {
        try {
            Class listenerClass = Class.forName(listenerClassName);
            Constructor listenerConstructor = listenerClass
                    .getConstructor(new Class[] { Map.class,
                            ObjectPool.class, HostGroup.class});
            Listener listener = (Listener) listenerConstructor
                    .newInstance(new Object[] { args, this.objectPool,
                            this.hostGroup });
            if (listener.start()) {
                this.listeners.add(listener);
            }
View Full Code Here

        if (ToolContainer.class.isAssignableFrom(clz)) {

            ToolContainer container = null;

            try {
                Constructor cons = clz.getConstructor(
                                                      new Class[] {
                                                          ToolSpec.class
                                                      });
                container = (ToolContainer)cons.newInstance(
                                                            new Object[] {
                                                                new ToolSpec(toolspecStream, validate)
                                                            });
            } catch (Exception ex) {
                Message message = new Message("CLZ_CANNOT_BE_CONSTRUCTED", LOG, clz.getName());
View Full Code Here

                Class<? extends AbstractTestServerBase> svcls =
                    cls.asSubclass(AbstractTestServerBase.class);
                if (null == serverArgs) {
                    inProcessServer = svcls.newInstance();
                } else {
                    Constructor ctor = svcls.getConstructor(serverArgs.getClass());
                    inProcessServer = (AbstractTestServerBase)ctor.newInstance(new Object[] {serverArgs});
                }
                inProcessServer.startInProcess();
                serverIsReady = true;
            } catch (Exception ex) {
                ex.printStackTrace();
View Full Code Here

            try {
                // JDK has package protected frame class -- ugh.
                final Class delegateClass = Class.forName(
                        "javax.swing.plaf.metal.MetalBorders$FrameBorder");

                final Constructor defaultConstructor
                        = delegateClass.getDeclaredConstructor(null);

                defaultConstructor.setAccessible(true);

                return (AbstractBorder) defaultConstructor.newInstance(null);

            } catch (final Exception e) {
                // Improbable, but at least make it possible for the caller to
                // see what happened.
                Logger.global.logp(Level.WARNING, FrameBorder.class.toString(),
View Full Code Here

      // Instantiate the desired Object using that classes constructor with a
      // single Object argument.
      Class [] argTypes = {Object.class};
      Object [] args = {configElem};
      Constructor constructor = requestedClass.getConstructor( argTypes );

      return constructor.newInstance( args );
    }
    catch ( ClassNotFoundException e )
    {
      logger.warn( "readDatasetScanUserDefined(): exception creating user defined object <" + className + ">", e );
      return null;
View Full Code Here

  }
  if (!AWTKeyStroke.class.isAssignableFrom(subclass)) {
      throw new ClassCastException("subclass is not derived from AWTKeyStroke");
  }

        Constructor ctor = getCtor(subclass);

  String couldNotInstantiate = "subclass could not be instantiated";

        if (ctor == null) {
      throw new IllegalArgumentException(couldNotInstantiate);
  }
  try {
      AWTKeyStroke stroke = (AWTKeyStroke)ctor.newInstance((Object[]) null);
      if (stroke == null) {
          throw new IllegalArgumentException(couldNotInstantiate);
      }
  } catch (NoSuchMethodError e) {
      throw new IllegalArgumentException(couldNotInstantiate);
View Full Code Here

    private static Constructor getCtor(final Class clazz)
    {
        Object ctor = AccessController.doPrivileged(new PrivilegedAction() {
            public Object run() {
                try {
                    Constructor ctor = clazz.getDeclaredConstructor((Class[]) null);
                    if (ctor != null) {
                        ctor.setAccessible(true);
                    }
                    return ctor;
                } catch (SecurityException e) {
                } catch (NoSuchMethodException e) {
                }
View Full Code Here

           */
          if (extensionValue == null) {
              try {
                  Class clazz = Class.forName("org.bouncycastle.asn1.DERInputStream");
                  if (clazz != null) {
                      Constructor constructor = clazz.getConstructor(new Class[]{InputStream.class});
                      InputStream is = (InputStream) constructor.newInstance(new Object[]{new ByteArrayInputStream(derEncodedValue)});
                      Method method = clazz.getMethod("readObject", new Class[]{});
                      Object obj = method.invoke(is, new Object[]{});
                      if (obj == null) {
                          throw new XMLSecurityException("certificate.noSki.null");
                      }
View Full Code Here

      // If we can't get the magic constructor, no need to look further.
      Class xniConfigClass=ObjectFactory.findProviderClass(
                            "com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration",
                            ObjectFactory.findClassLoader(), true);
      Class[] args1={xniConfigClass};
      Constructor ctor=SAXParser.class.getConstructor(args1);
     
      // Build the parser configuration object. StandardParserConfiguration
      // happens to implement XMLPullParserConfiguration, which is the API
      // we're going to want to use.
      Class xniStdConfigClass=ObjectFactory.findProviderClass(
                            "com.sun.org.apache.xerces.internal.parsers.StandardParserConfiguration",
                            ObjectFactory.findClassLoader(), true);
      fPullParserConfig=xniStdConfigClass.newInstance();
      Object[] args2={fPullParserConfig};
      fIncrementalParser = (SAXParser)ctor.newInstance(args2);
     
      // Preload all the needed the configuration methods... I want to know they're
      // all here before we commit to trying to use them, just in case the
      // API changes again.
      Class fXniInputSourceClass=ObjectFactory.findProviderClass(
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.