Package javassist

Examples of javassist.CtClass.writeFile()


        method.setBody(String.format("return \"%s\";", status));

        ctClass.addMethod(method);

        ctClass.writeFile(classesDir.getAbsolutePath());
    }

    private void createInvalidImplentationClass() throws Exception
    {
        ClassPool pool = new ClassPool(null);
View Full Code Here


        constructor.setModifiers(Modifier.PROTECTED);

        ctClass.addConstructor(constructor);

        ctClass.writeFile(classesDir.getAbsolutePath());
    }

    @Test
    public void eager_load_service_with_proxy()
    {
View Full Code Here

                ctClass);
        ctClass.addMethod(method);

        ctClass.addInterface(pool.get(Named.class.getName()));

        ctClass.writeFile(_extraClasspath.getAbsolutePath());
    }

    private Component createComponent(Class componentClass)
    {
        String classname = componentClass.getName();
View Full Code Here

        CtMethod method = CtNewMethod.make("public String getName() { return \"" + name + "\"; }", ctClass);
        ctClass.addMethod(method);

        ctClass.addInterface(pool.get(Named.class.getName()));

        ctClass.writeFile(extraClasspath.getAbsolutePath());
    }

    private Component createComponent(String classname)
    {
        InternalComponentResources resources = mockInternalComponentResources();
View Full Code Here

        CtClass ctClass = pool.makeClass(CLASS);

        ctClass.setSuperclass(pool.get(BASE_CLASS));

        ctClass.writeFile(classesDir.getAbsolutePath());

        Registry registry = createRegistry();

        ReloadableService reloadable = registry.getService(ReloadableService.class);
View Full Code Here

        method.setBody(String.format("return \"%s\";", status));

        ctClass.addMethod(method);

        ctClass.writeFile(classesDir.getAbsolutePath());
    }

    private void createInvalidImplentationClass() throws Exception
    {
        ClassPool pool = new ClassPool(null);
View Full Code Here

        constructor.setModifiers(Modifier.PROTECTED);

        ctClass.addConstructor(constructor);

        ctClass.writeFile(classesDir.getAbsolutePath());
    }

    @Test
    public void eager_load_service_with_proxy()
    {
View Full Code Here

                ctClass);
        ctClass.addMethod(method);

        ctClass.addInterface(pool.get(Named.class.getName()));

        ctClass.writeFile(_extraClasspath.getAbsolutePath());
    }

    private Component createComponent(Class componentClass)
    {
        String classname = componentClass.getName();
View Full Code Here

                ctClass);
        ctClass.addMethod(method);

        ctClass.addInterface(pool.get(Named.class.getName()));

        ctClass.writeFile(_extraClasspath.getAbsolutePath());
    }

    private Component createComponent(Class componentClass)
    {
        String classname = componentClass.getName();
View Full Code Here

        if (ctClazz.isModified()) {
          getLog().info("Writing enhanced class [" + clazzName + "]");
          // Trying to work around UIMA-2611, see
          // http://stackoverflow.com/questions/13797919/javassist-add-method-and-invoke
          ctClazz.toBytecode();
          ctClazz.writeFile(project.getBuild().getOutputDirectory());
        } else {
          getLog().info("No changes to class [" + clazzName + "]");
        }
      } catch (IOException e) {
        throw new MojoExecutionException("Enhanced class [" + clazzName + "] cannot be written: "
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.