Examples of parseClass()


Examples of groovy.lang.GroovyClassLoader.parseClass()

        InputStream in = new ByteArrayInputStream(bytes);
        GroovyCodeSource gcs = new GroovyCodeSource(in, templateName, "/groovy/shell");
        GroovyClassLoader loader = new GroovyClassLoader(Thread.currentThread().getContextClassLoader(), config);
        Class<?> scriptClass;
        try {
            scriptClass = loader.parseClass(gcs, false);
        } catch (CompilationFailedException e) {
            throw new GroovyCompilationException(e, templateText, groovyText);
        } catch (ClassFormatError e) {
            throw new GroovyCompilationException(e, templateText, groovyText);
        }
View Full Code Here

Examples of groovy.lang.GroovyClassLoader.parseClass()

         {
            public Class<?> run() throws Exception
            {
               if (name != null && name.length() > 0)
               {
                  return fLoader.parseClass(stream, name);
               }
               else
               {
                  return fLoader.parseClass(stream);
               }
View Full Code Here

Examples of groovy.lang.GroovyClassLoader.parseClass()

               {
                  return fLoader.parseClass(stream, name);
               }
               else
               {
                  return fLoader.parseClass(stream);
               }
            }
         });
      }
      catch (PrivilegedActionException pae)
View Full Code Here

Examples of groovy.lang.GroovyClassLoader.parseClass()

      final GroovyClassLoader fLoader = loader;
      Class<?> clazz = SecurityHelper.doPrivilegedAction(new PrivilegedAction<Class<?>>()
      {
         public Class<?> run()
         {
            return fLoader.parseClass(codeSource);
         }
      });

      try
      {
View Full Code Here

Examples of groovy.lang.GroovyClassLoader.parseClass()

    });
    script.run();

    String fileName = "src/main/java/Tester.groovy";
    GroovyClassLoader gcl = new GroovyClassLoader();
    Class clazz = gcl.parseClass(new File(fileName));
    Field[] fields = clazz.getFields();
    Field[] declaredFields = clazz.getDeclaredFields();
    Field declaredField = clazz.getDeclaredField("service");
    Object aScript = clazz.newInstance();
View Full Code Here

Examples of groovy.lang.GroovyClassLoader.parseClass()

    private void loadCommand(Resource file) {
        try {
            ClassLoader parent = getClass().getClassLoader();
            GroovyClassLoader loader = new GroovyClassLoader(parent);
            Class<? extends Command> groovyClass =
                    (Class<? extends Command>) loader.parseClass(file.read(), file.getName());

            if(groovyClass.isAnnotationPresent(CommandDefinition.class)) {
                boolean correctClass = false;
                for(Class groovyInterface : groovyClass.getInterfaces()) {
                    if(groovyInterface.equals(Command.class)) {
View Full Code Here

Examples of groovy.lang.GroovyClassLoader.parseClass()

    private Application loadApplication(ZipEntry zipentry, ZipInputStream zipinputstream, String name) throws IOException, IllegalAccessException, InstantiationException {
        String groovyString = new String(ByteStreams.toByteArray(zipinputstream), "UTF-8");

        GroovyClassLoader gcl = new GroovyClassLoader();
        Class clazz = gcl.parseClass(groovyString);

        Object aScript = clazz.newInstance();
        Application application = (Application) aScript;

        applicationContext.getAutowireCapableBeanFactory().autowireBean(application);
View Full Code Here

Examples of groovy.lang.GroovyClassLoader.parseClass()

     */
    private Response parseGroovy(String route) {
        try {
            // load the definition class into a RouteBuilder instance
            GroovyClassLoader classLoader = new GroovyClassLoader();
            Class<?> clazz = classLoader.parseClass(route);
            RouteBuilder builder = (RouteBuilder)clazz.newInstance();
            LOG.info("Loaded builder: " + builder);

            postRoutes(builder);

View Full Code Here

Examples of groovy.lang.GroovyClassLoader.parseClass()

     */
    private Response parseGroovy(String route) {
        try {
            // load the definition class into a RouteBuilder instance
            GroovyClassLoader classLoader = new GroovyClassLoader();
            Class<?> clazz = classLoader.parseClass(route);
            RouteBuilder builder = (RouteBuilder)clazz.newInstance();
            LOG.info("Loaded builder: " + builder);
            // add the route builder
            getCamelContext().addRoutes(builder);
            return Response.seeOther(new URI("/routes")).build();
View Full Code Here

Examples of groovy.lang.GroovyClassLoader.parseClass()

    private CachedRule loadGroovy(File file) {
        CachedRule entry = null;
        try {
            GroovyClassLoader gcl = new GroovyClassLoader();
            Class<?> clazz = gcl.parseClass(file);
            Rule rule = (Rule) clazz.newInstance();
            rule.setFactory(this);
            entry = new CachedRule(file.lastModified(), rule);
        } catch (Exception e) {
            e.printStackTrace();
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.