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", serviceInterface);
        cf.addField("_logger", ServiceLogger.class);

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


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

        cf.addField("_delegate", serviceInterface);
        cf.addField("_logger", 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, boolean eagerLoad,
            String proxyDescription)
    {
        ClassFab cf = _registry.newClass(serviceInterface);

        cf.addField("_creator", ObjectCreator.class);
        cf.addField("_delegate", serviceInterface);
        cf.addField("_shutdown", boolean.class);

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

            String proxyDescription)
    {
        ClassFab cf = _registry.newClass(serviceInterface);

        cf.addField("_creator", ObjectCreator.class);
        cf.addField("_delegate", serviceInterface);
        cf.addField("_shutdown", boolean.class);

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

    {
        ClassFab cf = _registry.newClass(serviceInterface);

        cf.addField("_creator", ObjectCreator.class);
        cf.addField("_delegate", serviceInterface);
        cf.addField("_shutdown", boolean.class);

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

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

    @Test
    public void create_simple_bean() throws Exception
    {
        ClassFab cf = newClassFab("TargetBean", Object.class);

        cf.addField("_stringValue", String.class);

        MethodSignature setStringValue = new MethodSignature(void.class, "setStringValue",
                new Class[]
                { String.class }, null);
View Full Code Here

    @Test
    public void proxy_methods_to_delegate() throws Exception
    {
        ClassFab cf = newClassFab("Delegator", Object.class);

        cf.addField("_delegate", SampleService.class);
        cf.addConstructor(new Class[]
        { SampleService.class }, null, "_delegate = $1;");

        cf.proxyMethodsToDelegate(SampleService.class, "_delegate", "<Delegator>");
View Full Code Here

    @Test
    public void proxy_methods_to_delegate_with_to_string() throws Exception
    {
        ClassFab cf = newClassFab("ToStringDelegator", Object.class);

        cf.addField("_delegate", ToStringService.class);
        cf.addConstructor(new Class[]
        { ToStringService.class }, null, "_delegate = $1;");

        cf.proxyMethodsToDelegate(ToStringService.class, "_delegate", "<ToStringDelegator>");
View Full Code Here

    @Test
    public void add_constructor() throws Exception
    {
        ClassFab cf = newClassFab("ConstructableBean", Object.class);

        cf.addField("_stringValue", String.class);
        cf.addConstructor(new Class[]
        { String.class }, null, "{ _stringValue = $1; }");

        MethodSignature getStringValue = new MethodSignature(String.class, "getStringValue", null,
                null);
View Full Code Here

    @Test
    public void add_constructor_from_base_class() throws Exception
    {
        ClassFab cf = newClassFab("MyIntHolder", AbstractIntWrapper.class);

        cf.addField("_intValue", int.class);
        cf.addConstructor(new Class[]
        { int.class }, null, "{ _intValue = $1; }");

        cf.addMethod(
                Modifier.PUBLIC,
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.