Package org.apache.tapestry.ioc.services

Examples of org.apache.tapestry.ioc.services.ClassFab.addField()


    private Class createInterceptorClass(Class serviceInterface, String serviceId)
    {
        ClassFab cf = _classFactory.newClass(serviceInterface);

        cf.addField("_delegate", Modifier.PRIVATE | Modifier.FINAL, serviceInterface);
        cf.addField("_logger", Modifier.PRIVATE | Modifier.FINAL, ServiceLogger.class);

        cf.addConstructor(new Class[]
        { serviceInterface, ServiceLogger.class }, null, "{ _delegate = $1; _logger = $2; }");

        addMethods(cf, serviceInterface, serviceId);
View Full Code Here


    private Class createProxyClass(String serviceId, Class serviceInterface, String proxyDescription)
    {
        ClassFab cf = _registry.newClass(serviceInterface);

        cf.addField("_creator", Modifier.PRIVATE | Modifier.FINAL, ObjectCreator.class);

        cf.addConstructor(new Class[]
        { ObjectCreator.class }, null, "_creator = $1;");

        addDelegateGetter(cf, serviceInterface, serviceId);
View Full Code Here

    {
        ClassFab cf = _classFactory.newClass(interfaceClass);

        String interfaceClassName = interfaceClass.getName();

        cf.addField("_registry", Modifier.PRIVATE | Modifier.FINAL, StrategyRegistry.class);
        cf.addConstructor(new Class[]
        { StrategyRegistry.class }, null, "_registry = $1;");

        BodyBuilder builder = new BodyBuilder();
View Full Code Here

    {
        Class serviceInterface = resources.getServiceInterface();

        ClassFab cf = _classFactory.newClass(serviceInterface);

        cf.addField("_creator", Modifier.PRIVATE | Modifier.FINAL, ObjectCreator.class);

        // Constructor takes a ServiceCreator

        cf.addConstructor(new Class[]
        { ObjectCreator.class }, null, "_creator = $1;");
View Full Code Here

    {
        String name = ClassFabUtils.generateClassName("PropBinding");

        ClassFab classFab = _classFactory.newClass(name, BasePropBinding.class);

        classFab.addField("_target", targetClass);

        classFab
                .addConstructor(
                        new Class[]
                        { targetClass, Class.class, String.class, AnnotationProvider.class,
View Full Code Here

            String fieldName = "_param_" + i;

            constructorParameterTypes[i + 1] = argType;
            constructorParameterValues[i + 1] = arg.getValue();

            cf.addField(fieldName, fieldType);

            // $1 is model, $2 is description, to $3 is first dynamic parameter.

            constructor.add("%s = $%d", fieldName, i + 2);
View Full Code Here

    private Class buildProxyClass(Class serviceType)
    {
        ClassFab classFab = _classFactory.newClass(serviceType);

        classFab.addField("_environment", Environment.class);
        classFab.addField("_serviceType", Class.class);

        classFab.addConstructor(new Class[] { Environment.class, Class.class }, null,
                                "{ _environment = $1; _serviceType = $2; }");
View Full Code Here

    private Class buildProxyClass(Class serviceType)
    {
        ClassFab classFab = _classFactory.newClass(serviceType);

        classFab.addField("_environment", Environment.class);
        classFab.addField("_serviceType", Class.class);

        classFab.addConstructor(new Class[] { Environment.class, Class.class }, null,
                                "{ _environment = $1; _serviceType = $2; }");

        classFab.addMethod(Modifier.PRIVATE, new MethodSignature(serviceType, "_delegate", null, null),
View Full Code Here

        ClassFab cf = newClassFab("InvalidField", Object.class);

        // You'd think some of these would fail, but the ultimate failure
        // occurs when we create the class.

        cf.addField("a%b", String.class);
        cf.addField("", int.class);

        // Aha! Adding a duplicate fails!

        cf.addField("buffy", int.class);
View Full Code Here

        // You'd think some of these would fail, but the ultimate failure
        // occurs when we create the class.

        cf.addField("a%b", String.class);
        cf.addField("", int.class);

        // Aha! Adding a duplicate fails!

        cf.addField("buffy", int.class);
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.