Package java.lang.reflect

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


            Class extensionClass = PacketExtension.getExtensionClass(name, namespace);
            // If a specific PacketExtension implementation has been registered, use that.
            if (extensionClass != null) {
                try {
                    Constructor constructor = extensionClass.getDeclaredConstructor(Element.class);
                    return (PacketExtension)constructor.newInstance(extensions.get(0));
                }
                catch (Exception e) {
                    // Ignore.
                }
            }
View Full Code Here


            Class extensionClass = PacketExtension.getExtensionClass(name, namespace);
            if (extensionClass != null) {
                try {
                    Constructor constructor = extensionClass.getDeclaredConstructor(new Class[]{
                        Element.class});
                    return (PacketExtension) constructor.newInstance(new Object[]{
                        extensions.get(0)});
                }
                catch (Exception e) {
                }
            }
View Full Code Here

         System.out.println( "Dumping available constructors on " + soughtClass.getName() + "\n" + ExternalUtility.dumpConstructors( soughtClass ) );

         throw e;
      }

      Object gradleRunner = constructor.newInstance( gradleHomeDirectory, interaction );

      return (GradleRunnerVersion1) gradleRunner;
   }
}
View Full Code Here

      log.error(message);
      throw new IllegalArgumentException(message);
    }
    for (Object[] parameters : records) {
      try {
        result.add(constructor.newInstance(parameters));
      } catch (Exception e) {
        log.error("无法构建投影类型对象", e.getCause()); // 不应该出现该错误
      }
    }
    return result;
View Full Code Here

      log.error(message);
      throw new IllegalArgumentException(message);
    }
    for (Object[] parameters : records) {
      try {
        result.add(constructor.newInstance(parameters));
      } catch (Exception e) {
        log.error("无法构建投影类型对象", e.getCause()); // 不应该出现该错误
      }
    }
    return result;
View Full Code Here

            widgetConstructor = wClass.getConstructor(new Class[] { Widget.class, String.class });
          constructorCache.put(widgetClass + (hasPreset ? "_P" : ""), widgetConstructor);
        }
        if (hasPreset)
          widget =
            (Widget) widgetConstructor.newInstance(
              new Object[] { parentWidget, widgetName.equals("") ? null : widgetName, widgetPreset });
        else
          widget =
            (Widget) widgetConstructor.newInstance(
              new Object[] { parentWidget, widgetName.equals("") ? null : widgetName });
View Full Code Here

          widget =
            (Widget) widgetConstructor.newInstance(
              new Object[] { parentWidget, widgetName.equals("") ? null : widgetName, widgetPreset });
        else
          widget =
            (Widget) widgetConstructor.newInstance(
              new Object[] { parentWidget, widgetName.equals("") ? null : widgetName });
      } catch (ClassNotFoundException e) {
        throw new GUIException("Unknown widget class [" + widgetNode.getAttribute("class") + "]");
      } catch (NoSuchMethodException e) {
        throw new GUIException("Widget constructor not found", e);
View Full Code Here

                           
                            // try to create instance of new converter passing old converter
                            try {
                                Constructor cons = clas.getConstructor(new Class[] { prior.getClass() });
                                try {
                                    return cons.newInstance(new Object[] { prior });
                                } catch (IllegalArgumentException e) { /* ignore failure */
                                } catch (InvocationTargetException e) {
                                    vctx.addWarning("Failed passing existing name converter to constructor for class " +
                                        cname + ": " + e.getMessage(), new ProblemLocation(ctx));
                                }
View Full Code Here

      final Constructor constructor = startupClass.getConstructor(new Class[] {
        String[].class
      });
     
      constructor.newInstance(new Object[] {
        args
      });

    } catch (Exception e) {
      // TODO Auto-generated catch block
View Full Code Here

         e.printStackTrace();
         System.out.println( "Dumping available constructors on " + soughtClass.getName() + "\n" + ExternalUtility.dumpConstructors( soughtClass ) );

         throw e;
      }
      Object singlePaneUI = constructor.newInstance( singlePaneUIArguments );
      return (SinglePaneUIVersion1) singlePaneUI;
   }

   /*
      Call this to instantiate a gradle UI that contains the main tab control
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.