Package org.apache.tapestry5.plastic

Examples of org.apache.tapestry5.plastic.InstructionBuilderCallback


        private void implementNotOpGetter(final Tree node)
        {
            // Implement get() as navigate, then do a method invocation based on node
            // then, then pass (wrapped) result to delegate.invert()

            plasticClass.introduceMethod(ConduitMethods.GET, new InstructionBuilderCallback()
            {
                public void doBuild(InstructionBuilder builder)
                {
                    Type expressionType = implementNotExpression(builder, node);
View Full Code Here


            builder.loadThis().loadArgument(0).invokeVirtual(getRootMethod);
        }

        private void implementListGetter(final Tree listNode)
        {
            plasticClass.introduceMethod(ConduitMethods.GET, new InstructionBuilderCallback()
            {
                public void doBuild(InstructionBuilder builder)
                {
                    implementListConstructor(builder, listNode);
View Full Code Here

            return ArrayList.class;
        }

        private void implementMapGetter(final Tree mapNode)
        {
            plasticClass.introduceMethod(ConduitMethods.GET, new InstructionBuilderCallback()
            {
                public void doBuild(InstructionBuilder builder)
                {
                    implementMapConstructor(builder, mapNode);
View Full Code Here

        public void implementNoOpMethod(MethodDescription method, String format, Object... arguments)
        {
            final String message = String.format(format, arguments);

            plasticClass.introduceMethod(method).changeImplementation(new InstructionBuilderCallback()
            {
                public void doBuild(InstructionBuilder builder)
                {
                    builder.throwException(RuntimeException.class, message);
                }
View Full Code Here

            final Term simpleTerm = buildTerm(activeType, term);

            if (simpleTerm.genericType.isPrimitive())
                return simpleTerm;

            return simpleTerm.withCallback(new InstructionBuilderCallback()
            {
                public void doBuild(InstructionBuilder builder)
                {
                    simpleTerm.callback.doBuild(builder);

                    builder.dupe().when(Condition.NULL, new InstructionBuilderCallback()
                    {
                        public void doBuild(InstructionBuilder builder)
                        {
                            switch (nullHandling)
                            {
View Full Code Here

        private Term buildGetterMethodAccessTerm(final Type activeType, String propertyName, final Method readMethod)
        {
            Type returnType = GenericsUtils.extractActualType(activeType, readMethod);

            return new Term(returnType, propertyName, new InstructionBuilderCallback()
            {
                public void doBuild(InstructionBuilder builder)
                {
                    invokeMethod(builder, readMethod, null, 0);
View Full Code Here

        private Term buildPublicFieldAccessTerm(Type activeType, String propertyName, final Field field)
        {
            final Type fieldType = GenericsUtils.extractActualType(activeType, field);

            return new Term(fieldType, propertyName, new InstructionBuilderCallback()
            {
                public void doBuild(InstructionBuilder builder)
                {
                    Class rawFieldType = field.getType();
View Full Code Here

            {
                public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
                {
                    return method.getAnnotation(annotationClass);
                }
            }, new InstructionBuilderCallback()
            {
                public void doBuild(InstructionBuilder builder)
                {
                    invokeMethod(builder, method, invokeNode, 1);
View Full Code Here

                        .injectFromInstanceContext();

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

                delegateMethod.changeImplementation(new InstructionBuilderCallback()
                {
                    public void doBuild(InstructionBuilder builder)
                    {
                        builder.loadThis().getField(objectCreatorField);
                        builder.invoke(CREATE_OBJECT);
                        builder.checkcast(interfaceType).returnResult();
                    }
                });

                for (Method method : interfaceType.getMethods())
                {
                    plasticClass.introduceMethod(method).delegateTo(delegateMethod);
                }

                if (!plasticClass.isMethodImplemented(PlasticUtils.TO_STRING_DESCRIPTION))
                {
                    final PlasticField descriptionField = plasticClass.introduceField(String.class, "description")
                            .injectFromInstanceContext();

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

       
        // TAP5-2235
        final String delegateTypeName = delegateType.getName();
        MethodDescription getDelegateMethodDescription =
                new MethodDescription(delegateTypeName, PlasticProxyFactoryImpl.INTERNAL_GET_DELEGATE);
        plasticClass.introduceMethod(getDelegateMethodDescription, new InstructionBuilderCallback()
        {
            public void doBuild(InstructionBuilder builder)
            {
                builder.loadThis().getField(delegateField);
                builder.checkcast(delegateType).returnResult();
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.plastic.InstructionBuilderCallback

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.