Examples of InstructionBuilderCallback


Examples of org.apache.tapestry5.plastic.InstructionBuilderCallback

        return instantiator.newInstance();
    }

    private void implementMethod(PlasticClass plasticClass, final Method method, final PlasticField commandsField)
    {
        plasticClass.introduceMethod(method).changeImplementation(new InstructionBuilderCallback()
        {
            @Override
            public void doBuild(InstructionBuilder builder)
            {
                builder.loadThis().getField(commandsField).iterateArray(new InstructionBuilderCallback()
                {
                    @Override
                    public void doBuild(InstructionBuilder builder)
                    {
                        // The command is on the stack; add the elements and invoke the method.
View Full Code Here

Examples of org.apache.tapestry5.plastic.InstructionBuilderCallback

        callback.doSwitch(this);

        if (!defaultAdded)
        {
            addDefault(new InstructionBuilderCallback()
            {
                @Override
                public void doBuild(InstructionBuilder builder)
                {
                    builder.throwException(IllegalArgumentException.class,
View Full Code Here

Examples of org.apache.tapestry5.plastic.InstructionBuilderCallback

    {
        check();

        final LocalVariable var = state.startVariable(type);

        new InstructionBuilderCallback()
        {
            public void doBuild(InstructionBuilder builder)
            {
                callback.doBuild(var, builder);
            }
View Full Code Here

Examples of org.apache.tapestry5.plastic.InstructionBuilderCallback

        Label ifFalseLabel = new Label();
        Label endIfLabel = new Label();

        v.visitJumpInsn(conditionToOpcode.get(condition), ifFalseLabel);

        new InstructionBuilderCallback()
        {
            public void doBuild(InstructionBuilder builder)
            {
                callback.ifTrue(builder);
            }
        }.doBuild(this);

        v.visitJumpInsn(GOTO, endIfLabel);

        v.visitLabel(ifFalseLabel);

        new InstructionBuilderCallback()
        {
            public void doBuild(InstructionBuilder builder)
            {
                callback.ifFalse(builder);
            }
View Full Code Here

Examples of org.apache.tapestry5.plastic.InstructionBuilderCallback

        Label doCheck = state.newLabel();

        Label exitLoop = new Label();

        new InstructionBuilderCallback()
        {
            public void doBuild(InstructionBuilder builder)
            {
                callback.buildTest(builder);
            }
        }.doBuild(this);

        v.visitJumpInsn(conditionToOpcode.get(condition), exitLoop);

        new InstructionBuilderCallback()
        {
            public void doBuild(InstructionBuilder builder)
            {
                callback.buildBody(builder);
            }
View Full Code Here

Examples of org.apache.tapestry5.plastic.InstructionBuilderCallback

    {
        check();

        if (!isMethodImplemented(PlasticUtils.TO_STRING_DESCRIPTION))
        {
            introduceMethod(PlasticUtils.TO_STRING_DESCRIPTION, new InstructionBuilderCallback()
            {
                public void doBuild(InstructionBuilder builder)
                {
                    builder.loadConstant(toStringValue).returnResult();
                }
View Full Code Here

Examples of org.apache.tapestry5.plastic.InstructionBuilderCallback

        plasticClass.introduceInterface(Component.class);

        final PlasticField resourcesField = plasticClass.introduceField(InternalComponentResources.class,
                "internalComponentResources").injectFromInstanceContext();

        plasticClass.introduceMethod(GET_COMPONENT_RESOURCES, new InstructionBuilderCallback()
        {
            public void doBuild(InstructionBuilder builder)
            {
                builder.loadThis().getField(resourcesField).returnResult();
            }
View Full Code Here

Examples of org.apache.tapestry5.plastic.InstructionBuilderCallback

                PlasticMethod delegateMethod = plasticClass.introducePrivateMethod(serviceInterface.getName(),
                        "delegate", null, null);

                // If not concerned with efficiency, this might be done with method advice instead.
                delegateMethod.changeImplementation(new InstructionBuilderCallback()
                {
                    public void doBuild(InstructionBuilder builder)
                    {
                        builder.loadThis().getField(plasticClass.getClassName(), creatorField.getName(),
                                ObjectCreator.class);
                        builder.invoke(ObjectCreator.class, Object.class, "createObject").checkcast(serviceInterface)
                                .returnResult();
                    }
                });

                for (Method m : serviceInterface.getMethods())
                {
                    plasticClass.introduceMethod(m).delegateTo(delegateMethod);
                }

                plasticClass.introduceMethod(WRITE_REPLACE).changeImplementation(new InstructionBuilderCallback()
                {
                    public void doBuild(InstructionBuilder builder)
                    {
                        builder.loadThis()
                                .getField(plasticClass.getClassName(), tokenField.getName(), ServiceProxyToken.class)
View Full Code Here

Examples of org.apache.tapestry5.plastic.InstructionBuilderCallback

                        .inject(creator);

                PlasticMethod delegateMethod = plasticClass.introducePrivateMethod(interfaceType.getName(), "delegate",
                        null, null);

                delegateMethod.changeImplementation(new InstructionBuilderCallback()
                {
                    public void doBuild(InstructionBuilder builder)
                    {
                        builder.loadThis().getField(objectCreatorField);
                        builder.invoke(ObjectCreator.class, Object.class, "createObject");
View Full Code Here

Examples of org.apache.tapestry5.plastic.InstructionBuilderCallback

            // TODO: Better handling error case where delegating to a primitive or object array.

            // TODO: Is there a easy way to ensure that the type has the necessary method? I don't
            // like that errors along those lines may be deferred until execution time.

            changeImplementation(new InstructionBuilderCallback()
            {
                public void doBuild(InstructionBuilder builder)
                {
                    // Load the field
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.