Package java.lang.reflect

Examples of java.lang.reflect.Constructor$ConstructorData


    for(int i = 0; i < DEFAULT_CONTRIBUTORS.length; i++)
    {
      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


         
           Class.forName("org.jdesktop.swingx.JXFrame");
          
                final Class startupClass = Class.forName("org.jmule.main.Launcher");

               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

    // Create an instance
    Analyzer analyzer;
    if ((stopWordList != null) && (stopWordList.length != 0)) {
      // Copy
      Constructor ctor;
      try {
        ctor = analyzerClass.getConstructor(
                new Class[]{Version.class, Set.class});
      } catch (Throwable thr) {
        throw new RegainException("Analyzer " + analyzerType
                + " does not support stop words", thr);
      }
      try {
        analyzer = (Analyzer) ctor.newInstance(new Object[]{Version.LUCENE_30, stopWordSet});
      } catch (Throwable thr) {
        throw new RegainException("Creating analyzer instance failed", thr);
      }

    } else {
      // instantiate analyser whitout stopwords.
      try {
        Constructor analyzerWithoutStopWords;
        try {
          analyzerWithoutStopWords = analyzerClass.getConstructor(
                  new Class[]{Version.class});
        } catch (Throwable thr) {
          throw new RegainException("Analyzer " + analyzerType
                  + " is not supported.", thr);
        }

        analyzer = (Analyzer) analyzerWithoutStopWords.newInstance(new Object[]{Version.LUCENE_30});
      } catch (Throwable thr) {
        throw new RegainException("Creating analyzer instance failed", thr);
      }
    }
View Full Code Here

                }

                // - if we couldn't find the method try with the constructor
                if (method == null)
                {
                    Constructor constructor;
                    try
                    {
                        constructor = expectedType.getConstructor(new Class[] {originalType});
                        object = constructor.newInstance(new Object[] {object});
                    }
                    catch (final NoSuchMethodException exception)
                    {
                        throw new IntrospectorException("Could not convert '" + object + "' to type '" +
                            expectedType.getName() + "'");
View Full Code Here

        {
            getLogger().debug(
                "constructing metafacade from class '" + metafacadeClass + "' mapping object '" + mappingObject +
                "', and context '" + context + "'");
        }
        final Constructor constructor = metafacadeClass.getDeclaredConstructors()[0];
        return (MetafacadeBase)constructor.newInstance(new Object[] {mappingObject, context});
    }
View Full Code Here

    Object retObject = null;

    try
    {
      Class classDefinition = classForName(classname);
      Constructor objectConstructor = classDefinition
          .getConstructor(conArgsClass);
      retObject = objectConstructor.newInstance(conArgs);
    }
    catch (Exception e)
    {
      if ((e.getCause() != null) && (e.getCause() instanceof XException))
      {
View Full Code Here

                    + authMethod.substring(1).toLowerCase()
                    + "AuthenticationHandler";
            try {
                // Build the realm
                Class realmClass = Class.forName(realmClassName, true, parentClassLoader);
                Constructor realmConstr = realmClass.getConstructor(
                        new Class[] {Set.class, Map.class });
                this.authenticationRealm = (AuthenticationRealm) realmConstr.newInstance(
                        new Object[] { rolesAllowed, startupArgs });

                // Build the authentication handler
                Class authClass = Class.forName(authClassName);
                Constructor authConstr = authClass
                        .getConstructor(new Class[] { Node.class, List.class,
                                Set.class, AuthenticationRealm.class });
                this.authenticationHandler = (AuthenticationHandler) authConstr
                        .newInstance(new Object[] { loginConfigNode,
                                constraintNodes, rolesAllowed,
                                authenticationRealm });
            } catch (ClassNotFoundException err) {
                Logger.log(Logger.DEBUG, Launcher.RESOURCES,
                        "WebAppConfig.AuthDisabled", authMethod);
            } catch (Throwable err) {
                Logger.log(Logger.ERROR, Launcher.RESOURCES,
                        "WebAppConfig.AuthError", new String[] { authClassName,
                                realmClassName }, err);
            }
        } else if (!stringArg(startupArgs, "realmClassName", "").trim().equals("")) {
            Logger.log(Logger.DEBUG, Launcher.RESOURCES, "WebAppConfig.NoWebXMLSecurityDefs");
        }

        // Instantiate the JNDI manager
        String jndiMgrClassName = stringArg(startupArgs, "webappJndiClassName",
                DEFAULT_JNDI_MGR_CLASS).trim();
        if (useJNDI) {
            try {
                // Build the realm
                Class jndiMgrClass = Class.forName(jndiMgrClassName, true, parentClassLoader);
                Constructor jndiMgrConstr = jndiMgrClass.getConstructor(new Class[] {
                        Map.class, List.class, ClassLoader.class });
                this.jndiManager = (JNDIManager) jndiMgrConstr.newInstance(new Object[] {
                        null, envEntryNodes, this.loader });
                if (this.jndiManager != null)
                    this.jndiManager.setup();
            } catch (ClassNotFoundException err) {
                Logger.log(Logger.DEBUG, Launcher.RESOURCES,
                        "WebAppConfig.JNDIDisabled");
            } catch (Throwable err) {
                Logger.log(Logger.ERROR, Launcher.RESOURCES,
                        "WebAppConfig.JNDIError", jndiMgrClassName, err);
            }
        }
       
        String loggerClassName = stringArg(startupArgs, "accessLoggerClassName", "").trim();
        if (!loggerClassName.equals("")) {
            try {
                // Build the realm
                Class loggerClass = Class.forName(loggerClassName, true, parentClassLoader);
                Constructor loggerConstr = loggerClass.getConstructor(new Class[] {
                        WebAppConfiguration.class, Map.class });
                this.accessLogger = (AccessLogger) loggerConstr.newInstance(new Object[] {
                        this, startupArgs});
            } catch (Throwable err) {
                Logger.log(Logger.ERROR, Launcher.RESOURCES,
                        "WebAppConfig.LoggerError", loggerClassName, err);
            }
View Full Code Here

        // Try to set up the preferred class loader, and if we fail, use the normal one
        ClassLoader outputCL = null;
        if (!preferredClassLoader.equals("")) {
            try {
                Class preferredCL = Class.forName(preferredClassLoader, true, parentClassLoader);
                Constructor reloadConstr = preferredCL.getConstructor(new Class[] {
                        URL[].class, ClassLoader.class});
                outputCL = (ClassLoader) reloadConstr.newInstance(new Object[] {
                        jarURLs, parentClassLoader});
            } catch (Throwable err) {
                if (!stringArg(startupArgs, "preferredClassLoader", "").equals("") ||
                        !preferredClassLoader.equals(WEBAPP_CL_CLASS)) {
                    Logger.log(Logger.ERROR, Launcher.RESOURCES, "WebAppConfig.CLError", err);
View Full Code Here

            // If unknown type, try to instantiate with the string constructor
            else if (value != null) {
                try {
                    Class objClass = Class.forName(className.trim(), true, loader);
                    Constructor objConstr = objClass
                            .getConstructor(new Class[] { String.class });
                    return objConstr.newInstance(new Object[] { value });
                } catch (Throwable err) {
                    Logger.log(Logger.ERROR, JNDI_RESOURCES,
                            "ContainerJNDIManager.ErrorBuildingObject", new String[] {
                                    name, className }, err);
                }
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.