Package java.lang

Examples of java.lang.Class$MethodKey


                try {
                    URL[] urls = new URL[1];
                    urls[0] = new URL(factoryJar);
                    ClassLoader loader = new URLClassLoader(urls,
                        TupleFactory.class.getClassLoader());
                    Class c = Class.forName(factoryName, true, loader);
                    Object o = c.newInstance();
                    if (!(o instanceof TupleFactory)) {
                        throw new RuntimeException("Provided factory " +
                            factoryName + " does not extend TupleFactory!");
                    }
                    gSelf = (TupleFactory)o;
                } catch (Exception e) {
                    if (e instanceof RuntimeException) {
                        // We just threw this
                        RuntimeException re = (RuntimeException)e;
                        throw re;
                    }
                    throw new RuntimeException("Unable to instantiate "
                        + "tuple factory " + factoryName, e);
                }
            } else if (factoryName != null) {
                try {
                    Class c = Class.forName(factoryName);
                    Object o = c.newInstance();
                    if (!(o instanceof TupleFactory)) {
                        throw new RuntimeException("Provided factory " +
                            factoryName + " does not extend TupleFactory!");
                    }
                    gSelf = (TupleFactory)o;
View Full Code Here


            }
            globalClosures.setBundle(bundle);
        } catch (ClassCastException cce) { /*ignore.*/ }

        try {
            Class clazz = getScriptClass(script);
            if (clazz == null) throw new ScriptException("Script class is null");
            return eval(clazz, ctx);
        } catch (SyntaxException e) {
            throw new ScriptException(e.getMessage(),
                    e.getSourceLocator(), e.getLine());
View Full Code Here

    Class getScriptClass(String script)
            throws SyntaxException,
            CompilationFailedException,
            IOException {
        Class clazz = classMap.get(script);
        if (clazz != null) {
            return clazz;
        }

        clazz = loader.parseClass(script, generateScriptName());
View Full Code Here

    // for GroovyClassLoader instance
    private static ClassLoader getParentLoader() {
        // check whether thread context loader can "see" Groovy Script class
        ClassLoader ctxtLoader = Thread.currentThread().getContextClassLoader();
        try {
            Class c = ctxtLoader.loadClass(Script.class.getName());
            if (c == Script.class) {
                return ctxtLoader;
            }
        } catch (ClassNotFoundException cnfe) {
            /* ignore */
 
View Full Code Here

      if (protocol == null)
      {
        throw new RuntimeException("The connection protocol for the repository "+repos+" was null.");
      }
     
      Class con;
      Constructor constr;
      Class[] constrArgs = new Class[]{pHtoolsConfig.class,String.class};

      try
      {
        //System.out.println("Running forName");
                  con = Class.forName(protocol);
        //System.out.println("Done forName");
       
        //System.out.println("Running getConstructor");
        constr = con.getConstructor(constrArgs);
        //System.out.println("Done getConstructor");
       
        //System.out.println("Running newInstance");
        out = (pHtoolsConnectivity)constr.newInstance(this.config,repos);
        //System.out.println("Done newInstance");
View Full Code Here

            return data_reader.invoke(o);
        }

        private Object readRecord(PushbackReader r, Symbol recordName) {
            Class recordClass = RT.classForName(recordName.toString());
            char endch;
            boolean shortForm = true;
            int ch = read1(r);

            // flush whitespace
            // while(isWhitespace(ch))
            // ch = read1(r);

            // A defrecord ctor can take two forms. Check for map->R version
            // first.
            if (ch == '{') {
                endch = '}';
                shortForm = false;
            } else if (ch == '[')
                endch = ']';
            else
                throw Util.runtimeException("Unreadable constructor form starting with \"#"
                        + recordName + (char) ch + "\"");

            Object[] recordEntries = readDelimitedList(endch, r, true).toArray();
            Object ret = null;
            Constructor[] allctors = ((Class) recordClass).getConstructors();

            if (shortForm) {
                boolean ctorFound = false;
                for (Constructor ctor : allctors)
                    if (ctor.getParameterTypes().length == recordEntries.length)
                        ctorFound = true;

                if (!ctorFound)
                    throw Util.runtimeException("Unexpected number of constructor arguments to "
                            + recordClass.toString() + ": got " + recordEntries.length);

                ret = Reflector.invokeConstructor(recordClass, recordEntries);
            } else {

                IPersistentMap vals = RT.map(recordEntries);
View Full Code Here

TOP

Related Classes of java.lang.Class$MethodKey

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.