Package java.lang.reflect

Examples of java.lang.reflect.Constructor$ConstructorData


        XPath xpath = null;
        Class[] classes = new Class[]{String.class, SourceLocator.class, PrefixResolver.class, int.class,
                ErrorListener.class, FunctionTable.class};
        Object[] objects = new Object[]{str, null, prefixResolver, new Integer(XPath.SELECT), null, _funcTable};
        try {
            Constructor constructor = XPath.class.getConstructor(classes);
            xpath = (XPath) constructor.newInstance(objects);
        } catch (Throwable t) {
        }
        if (xpath == null) {
            xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null);
        }
View Full Code Here


    public PropertyEditor createPropertyEditor(Object bean) {
  Object editor = null;

  Class cls = getPropertyEditorClass();
  if (cls != null) {
      Constructor ctor = null;
      if (bean != null) {
    try {
        ctor = cls.getConstructor(new Class[] { Object.class });
    } catch (Exception ex) {
        // Fall through
    }
      }
      try {
    if (ctor == null) {
        editor = cls.newInstance();
    } else {
        editor = ctor.newInstance(new Object[] { bean });
    }
      } catch (Exception ex) {
    // A serious error has occured.
    // Proably due to an invalid property editor.
    throw new RuntimeException("PropertyEditor not instantiated",
View Full Code Here

     * Return a constructor on the class with the arguments.
     *
     * @throws exception if the method is ambiguios.
     */
    public static Constructor getConstructor(Class cls, Class[] args) {
  Constructor constructor = null;

  // PENDING: Implement the resolutuion of ambiguities properly.
  Constructor[] ctors = ConstructorUtil.getConstructors(cls);
  for(int i = 0; i < ctors.length; i++) {
      if (matchArguments(args, ctors[i].getParameterTypes())) {
View Full Code Here

  this.parent = parent;
    }

    public Object run() throws Exception {
  ClassLoader sys;
  Constructor ctor;
  Class c;
  Class cp[] = { ClassLoader.class };
  Object params[] = { parent };

        String cls = System.getProperty("java.system.class.loader");
  if (cls == null) {
      return parent;
  }

  c = Class.forName(cls, true, parent);
  ctor = c.getDeclaredConstructor(cp);
  sys = (ClassLoader) ctor.newInstance(params);
  Thread.currentThread().setContextClassLoader(sys);
  return sys;
    }
View Full Code Here

            MethodNode mn = new MethodNode(m.getName(), m.getModifiers(), ClassHelper.make(m.getReturnType()), createParameters(m.getParameterTypes()), ClassHelper.make(m.getExceptionTypes()), null);
            classNode.addMethod(mn);
        }
        Constructor[] constructors = clazz.getDeclaredConstructors();
        for (int i = 0; i < constructors.length; i++) {
            Constructor ctor = constructors[i];
            classNode.addConstructor(ctor.getModifiers(), createParameters(ctor.getParameterTypes()), ClassHelper.make(ctor.getExceptionTypes()), null);
        }

        Class sc = clazz.getSuperclass();
        if (sc != null) classNode.setUnresolvedSuperClass(getPrimaryClassNode(compileUnit,sc));
View Full Code Here

        }
    }

    private static MethodHandle createCompiledMethodHandle(Method method, ClassLoaderForClassArtifacts loader) {
        try {
          Constructor c = compileMethodHandle(method, loader);
          if (c != null)
            return (MethodHandle) c.newInstance();
        } catch (Throwable e) { //
        }
        return new ReflectiveMethodHandle(method);
    }
View Full Code Here

        return ref.get();
    }

    public CallSite createPogoMetaMethodSite(CallSite site, MetaClassImpl metaClass, Class[] params) {
        if (!skipCompiled) {
            Constructor constr = getConstrcutor(pogoCallSiteConstructor);
            if (constr==null) {
                if (CallSiteGenerator.isCompilable(this)) {
                  constr = CallSiteGenerator.compilePogoMethod(this);
                }
                if (constr != null) {
                     pogoCallSiteConstructor = new SoftReference<Constructor> (constr);
                } else {
                    skipCompiled = true;
                }
            }
   
            if (constr!=null) {
                try {
                    return (CallSite) constr.newInstance(site, metaClass, this, params, constr);
                } catch (Error e) {
                    skipCompiled=true;
                    throw e;
                } catch (Throwable e) {
                    skipCompiled=true;
View Full Code Here

    }


    public CallSite createPojoMetaMethodSite(CallSite site, MetaClassImpl metaClass, Class[] params) {
        if (!skipCompiled) {
            Constructor constr = getConstrcutor(pojoCallSiteConstructor);
            if (constr==null) {
                if (CallSiteGenerator.isCompilable(this)) {
                  constr = CallSiteGenerator.compilePojoMethod(this);
                }
                if (constr != null) {
                    pojoCallSiteConstructor = new SoftReference<Constructor> (constr);
                } else {
                    skipCompiled = true;
                }
            }
   
            if (constr!=null) {
                try {
                    return (CallSite) constr.newInstance(site, metaClass, this, params, constr);
                } catch (Error e) {
                    skipCompiled=true;
                    throw e;
                } catch (Throwable e) {
                    skipCompiled=true;
View Full Code Here

        return new PojoMetaMethodSite.PojoCachedMethodSiteNoUnwrapNoCoerce(site, metaClass, this, params);
    }

    public CallSite createStaticMetaMethodSite(CallSite site, MetaClassImpl metaClass, Class[] params) {
        if (!skipCompiled) {
            Constructor constr = getConstrcutor(staticCallSiteConstructor);
            if (constr==null) {
                if (CallSiteGenerator.isCompilable(this)) {
                  constr = CallSiteGenerator.compileStaticMethod(this);
                }
                if (constr != null) {
                    staticCallSiteConstructor = new SoftReference<Constructor> (constr);
                } else {
                    skipCompiled = true;
                }
            }
   
            if (constr!=null) {
                try {
                    return (CallSite) constr.newInstance(site, metaClass, this, params, constr);
                } catch (Error e) {
                    skipCompiled=true;
                    throw e;
                } catch (Throwable e) {
                    skipCompiled=true;
View Full Code Here

    }

    // Constructors (reflection):
    if (true) {
    {
      final Constructor c = javax.media.ResourceUnavailableEvent.class.getConstructor(new Class[]{javax.media.Controller.class});
      assertEquals(c.getModifiers(), 1);
    }
    {
      final Constructor c = javax.media.ResourceUnavailableEvent.class.getConstructor(new Class[]{javax.media.Controller.class, java.lang.String.class});
      assertEquals(c.getModifiers(), 1);
    }
    }

    // Methods (compilation):
    if (false) {
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.