Package com.strobel.reflection.emit

Examples of com.strobel.reflection.emit.MethodBuilder


            Modifier.PUBLIC | Modifier.FINAL,
            Types.Object,
            Type.list(Type.of(Runnable.class))
        );

        final MethodBuilder powerMethod = typeBuilder.defineMethod(
            "power",
            Modifier.PUBLIC | Modifier.FINAL,
            PrimitiveTypes.Integer,
            Type.list(PrimitiveTypes.Integer, PrimitiveTypes.Integer)
        );

        final MethodBuilder runMethod = typeBuilder.defineMethod(
            "run",
            Modifier.PUBLIC | Modifier.FINAL,
            PrimitiveTypes.Void
        );
View Full Code Here


        final FieldBuilder staticField = typeBuilder.defineField(
            "Numbers",
            Type.of(int[].class),
            Modifier.PUBLIC | Modifier.FINAL | Modifier.STATIC);

        final MethodBuilder typeInitializer = typeBuilder.defineTypeInitializer();

        lambda(
            Types.Runnable,
            assign(
                field(null, staticField),
View Full Code Here

            Modifier.PUBLIC | Modifier.FINAL,
            Types.Object,
            Type.list(Type.of(Runnable.class))
        );

        final MethodBuilder powerMethod = typeBuilder.defineMethod(
            "power",
            Modifier.PUBLIC | Modifier.FINAL,
            PrimitiveTypes.Integer,
            Type.list(PrimitiveTypes.Integer, PrimitiveTypes.Integer)
        );

        final MethodBuilder runMethod = typeBuilder.defineMethod(
            "run",
            Modifier.PUBLIC | Modifier.FINAL,
            PrimitiveTypes.Void
        );
View Full Code Here

            "Numbers",
            Type.of(int[].class),
            Modifier.PUBLIC | Modifier.FINAL | Modifier.STATIC
        );

        final MethodBuilder typeInitializer = typeBuilder.defineTypeInitializer();

        lambda(
            Types.Runnable,
            assign(
                field(null, staticField),
View Full Code Here

            )
        );

        final MethodInfo baseMethod = baseType.getMethod("toString");

        final MethodBuilder toString = derivedType.defineMethod(
            "toString",
            Modifier.PUBLIC|Modifier.FINAL,
            Types.String
        );

        lambda.compileToMethod(toString);

        final Type<?> generatedType = derivedType.createType();

        assertEquals("Base:Derived", generatedType.newInstance().toString());
        assertSame(baseMethod, toString.findOverriddenMethod());
    }
View Full Code Here

        VerifyArgument.notNull(typeBuilder, "typeBuilder");
        VerifyArgument.notNullOrWhitespace(name, "name");

        final MethodInfo invokeMethod = Expression.getInvokeMethod(this);

        final MethodBuilder methodBuilder = typeBuilder.defineMethod(
            name,
            modifiers,
            invokeMethod.getReturnType(),
            invokeMethod.getParameters().getParameterTypes()
        );
View Full Code Here

TOP

Related Classes of com.strobel.reflection.emit.MethodBuilder

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.