Package javassist

Examples of javassist.CtClass$DelayedFileOutputStream


    }

    @Test
    public void ensure_javassist_does_not_show_interface_methods_on_abstract_class() throws Exception
    {
        CtClass ctClass = findCtClass(AbstractFoo.class);

        CtClass[] interfaces = ctClass.getInterfaces();

        assertEquals(interfaces.length, 1);

        assertEquals(interfaces[0].getName(), FooInterface.class.getName());

        // In some cases, Java reflection on an abstract class implementing an interface
        // will show the interface methods as abstract methods on the class. This seems
        // to vary from JVM to JVM. I believe Javassist is more consistent here.

        CtMethod[] methods = ctClass.getDeclaredMethods();

        assertEquals(methods.length, 0);
    }
View Full Code Here


    }

    @Test
    public void ensure_javassist_does_not_show_extended_interface_methods_on_interface() throws Exception
    {
        CtClass ctClass = findCtClass(FooBarInterface.class);

        // Just want to check that an interface that extends other interfaces
        // doesn't show those other interface's methods.

        CtMethod[] methods = ctClass.getDeclaredMethods();

        assertEquals(methods.length, 0);
    }
View Full Code Here

    @Test
    public void add_injected_field() throws Exception
    {
        InternalComponentResources resources = mockInternalComponentResources();

        CtClass targetObjectCtClass = findCtClass(TargetObject.class);

        Logger logger = mockLogger();
        MutableComponentModel model = mockMutableComponentModel(logger);

        replay();
View Full Code Here

        Logger logger = mockLogger();
        MutableComponentModel model = mockMutableComponentModel(logger);

        replay();

        CtClass targetObjectCtClass = findCtClass(ReadOnlyBean.class);

        InternalClassTransformation ct = new InternalClassTransformationImpl(classFactory, targetObjectCtClass, null,
                model, null);

        ct.makeReadOnly("_value");
View Full Code Here

        Logger logger = mockLogger();
        MutableComponentModel model = mockMutableComponentModel(logger);

        replay();

        CtClass targetObjectCtClass = findCtClass(ReadOnlyBean.class);

        InternalClassTransformation ct = new InternalClassTransformationImpl(classFactory, targetObjectCtClass, null,
                model, null);

        ct.injectField("_value", "Tapestry");
View Full Code Here

        Logger logger = mockLogger();
        MutableComponentModel model = mockMutableComponentModel(logger);

        replay();

        CtClass targetObjectCtClass = findCtClass(FieldAccessBean.class);

        InternalClassTransformation ct = new InternalClassTransformationImpl(classFactory, targetObjectCtClass, null,
                model, null);

        replaceAccessToField(ct, "foo");
View Full Code Here

        InternalClassTransformation parentTransform = createClassTransformation(SimpleBean.class, logger);

        parentTransform.finish();

        CtClass childClass = findCtClass(SimpleBeanSubclass.class);

        ClassTransformation childTransform = parentTransform.createChildTransformation(childClass,
                stubMutableComponentModel(logger));

        assertFalse(childTransform.isMethodOverride(new TransformMethodSignature("notOverridden")));
View Full Code Here

    public void addField(String name, int modifiers, Class type)
    {
        lock.check();

        CtClass ctType = toCtClass(type);

        try
        {
            CtField field = new CtField(ctType, name, getCtClass());
            field.setModifiers(modifiers);
View Full Code Here

        lock.check();

        if (addedSignatures.contains(ms))
            throw new RuntimeException(ServiceMessages.duplicateMethodInClass(ms, this));

        CtClass ctReturnType = toCtClass(ms.getReturnType());

        CtClass[] ctParameters = toCtClasses(ms.getParameterTypes());
        CtClass[] ctExceptions = toCtClasses(ms.getExceptionTypes());

        CtMethod method = new CtMethod(ctReturnType, ms.getName(), ctParameters, getCtClass());
View Full Code Here

        for (final Method method : methods)
        {
            try
            {
                CtClass ctType = toCtClass(method.getReturnType());
               
                final MemberValue memberValue = javassist.bytecode.annotation.Annotation.createMemberValue(constPool, ctType);
                final Object value = method.invoke(source);

                memberValue.accept(new AnnotationMemberValueVisitor(constPool, getSource(), value));
View Full Code Here

TOP

Related Classes of javassist.CtClass$DelayedFileOutputStream

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.