Examples of IntroductionDefinition


Examples of org.codehaus.aspectwerkz.definition.IntroductionDefinition

        if (newImplementationClass == null) {
            throw new IllegalArgumentException("new implementation class class can not be null");
        }

        // check compatibility
        IntroductionDefinition def = m_prototype.getIntroductionDefinition();
        for (Iterator intfs = def.getInterfaceClassNames().iterator(); intfs.hasNext();) {
            if (!findInterfaceInHierarchy(newImplementationClass, (String)intfs.next())) {
                throw new DefinitionException("new implementation class is not compatible");
            }
        }
        synchronized (this) {
View Full Code Here

Examples of org.codehaus.aspectwerkz.definition.IntroductionDefinition

                isClassAdvised = true;
            }
        }
        List introDefs = definition.getIntroductionDefinitions(ctx);
        for (Iterator it = introDefs.iterator(); it.hasNext();) {
            IntroductionDefinition introductionDef = (IntroductionDefinition)it.next();
            List interfaceClassNames = introductionDef.getInterfaceClassNames();
            if (addInterfaces(interfaceClassNames, cg)) {
                isClassAdvised = true;
            }
        }
        if (isClassAdvised) {
View Full Code Here

Examples of org.codehaus.aspectwerkz.definition.IntroductionDefinition

            final ExpressionContext ctx, final CtClass ctClass,
            final AddImplementationTransformer transformer) {
        List introductionDefs = definition.getIntroductionDefinitions(ctx);
        boolean isClassAdvised = false;
        for (Iterator it = introductionDefs.iterator(); it.hasNext();) {
            IntroductionDefinition introDef = (IntroductionDefinition)it.next();
            int methodIndex = 0;
            List methodsToIntroduce = introDef.getMethodsToIntroduce();
            for (Iterator mit = methodsToIntroduce.iterator(); mit.hasNext(); methodIndex++) {
                MethodInfo methodToIntroduce = (MethodInfo)mit.next();
                if (methodToIntroduce == null) {
                    continue;
                }
                transformer.createProxyMethod(
                        ctClass, methodToIntroduce,
                        definition.getMixinIndexByName(introDef.getName()), methodIndex,
                        definition, context
                );
                isClassAdvised = true;
            }
        }
View Full Code Here

Examples of org.codehaus.aspectwerkz.definition.IntroductionDefinition

        if (newImplementationClass == null) {
            throw new IllegalArgumentException("new implementation class class can not be null");
        }

        // check compatibility
        IntroductionDefinition def = m_prototype.getIntroductionDefinition();
        for (Iterator intfs = def.getInterfaceClassNames().iterator(); intfs.hasNext();) {
            if (!findInterfaceInHierarchy(newImplementationClass, (String) intfs.next())) {
                throw new DefinitionException("new implementation class is not compatible");
            }
        }
        synchronized (this) {
View Full Code Here

Examples of org.codehaus.aspectwerkz.definition.IntroductionDefinition

                                }

                                // mixins
                                List introductions = crossCuttingInfo.getAspectDefinition().getIntroductions();
                                for (Iterator it = introductions.iterator(); it.hasNext();) {
                                    IntroductionDefinition introDef = (IntroductionDefinition)it.next();

                                    // load default mixinPrototype impl from the aspect which defines it
                                    Class defaultImplClass = crossCuttingInfo.getAspectClass().getClassLoader()
                                            .loadClass(introDef.getName());
                                    Introduction mixinPrototype = new Introduction(
                                            introDef.getName(),
                                            defaultImplClass, crossCuttingInfo,
                                            introDef
                                    );
                                    IntroductionContainer introductionContainer = new IntroductionContainer(
                                            mixinPrototype,
                                            aspectContainer
                                    );
                                    aspectContainer.addIntroductionContainer(
                                            introDef.getName(), introductionContainer
                                    );

                                    // prepare the aspectContainer
                                    mixinPrototype.setContainer(introductionContainer);
                                    final Mixin[] tmpMixins = new Mixin[m_mixins.length + 1];
View Full Code Here

Examples of org.codehaus.aspectwerkz.xmldef.definition.IntroductionDefinition

    public void testIntroductionTag() {
        try {
            AspectWerkzDefinition aspectwerkz = (AspectWerkzDefinition)XmlParser.parseNoCache(m_input.toURL()).get(0);
            Iterator it = aspectwerkz.getIntroductionDefinitions().iterator();
            it.next();//skip "loggable"
            IntroductionDefinition introduction2 = (IntroductionDefinition)it.next();
            assertEquals("mixin", introduction2.getName());
            assertEquals("mixins.Mixin", introduction2.getInterface());
            assertEquals("mixins.MixinImpl", introduction2.getImplementation());
            assertEquals("perInstance", introduction2.getDeploymentModel());
            assertEquals("attribute", introduction2.getAttribute());
        }
        catch (Exception e) {
            System.out.println("e = " + e);
            fail();
        }
View Full Code Here

Examples of org.codehaus.aspectwerkz.xmldef.definition.IntroductionDefinition

     * @param definition the AspectWerkz definition
     */
    private static void handleIntroductionDefinitions(final Element root,
                                                      final AspectWerkzDefinitionImpl definition) {
        for (Iterator it = definition.getIntroductionDefinitions().iterator(); it.hasNext();) {
            IntroductionDefinition def = (IntroductionDefinition)it.next();
            addIntroductionDefElement(root, def);
        }
    }
View Full Code Here

Examples of org.codehaus.aspectwerkz.xmldef.definition.IntroductionDefinition

        for (int i = 0; i < introductionDefTags.length; i++) {
            if (introductionDefTags[i] == null) {
                continue;
            }

            IntroductionDefinition introDef = new IntroductionDefinition();
            introDef.setName(introductionDefTags[i].getNamedParameter("name"));
            introDef.setInterface(javaClass.getFullyQualifiedName());
            introDef.setImplementation(introductionDefTags[i].getNamedParameter("implementation"));
            introDef.setDeploymentModel(introductionDefTags[i].getNamedParameter("deployment-model"));
            introDef.setAttribute(introductionDefTags[i].getNamedParameter("attribute"));

            definition.addIntroduction(introDef);
        }
    }
View Full Code Here

Examples of org.codehaus.aspectwerkz.xmldef.definition.IntroductionDefinition

    public void testIntroductionTag() {
        try {
            AspectWerkzDefinition aspectwerkz = (AspectWerkzDefinition)XmlParser.parseNoCache(m_input.toURL()).get(0);
            Iterator it = aspectwerkz.getIntroductionDefinitions().iterator();
            it.next();//skip "loggable"
            IntroductionDefinition introduction2 = (IntroductionDefinition)it.next();
            assertEquals("mixin", introduction2.getName());
            assertEquals("mixins.Mixin", introduction2.getInterface());
            assertEquals("mixins.MixinImpl", introduction2.getImplementation());
            assertEquals("perInstance", introduction2.getDeploymentModel());
            assertEquals("attribute", introduction2.getAttribute());
        }
        catch (Exception e) {
            System.out.println("e = " + e);
            fail();
        }
View Full Code Here

Examples of org.codehaus.aspectwerkz.xmldef.definition.IntroductionDefinition

     * @param definition the AspectWerkz definition
     */
    private static void handleIntroductionDefinitions(final Element root,
                                                      final AspectWerkzDefinitionImpl definition) {
        for (Iterator it = definition.getIntroductionDefinitions().iterator(); it.hasNext();) {
            IntroductionDefinition def = (IntroductionDefinition)it.next();
            addIntroductionDefElement(root, def);
        }
    }
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.