Package org.apache.tapestry.ioc.services

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


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

        // Aha! Adding a duplicate fails!

        cf.addField("buffy", int.class);

        try
        {
            cf.addField("buffy", String.class);
            unreachable();
View Full Code Here


        cf.addField("buffy", int.class);

        try
        {
            cf.addField("buffy", String.class);
            unreachable();
        }
        catch (RuntimeException ex)
        {
            assertEquals(
View Full Code Here

        ClassFab cf = newClassFab("FredRunnable", BaseLocatable.class);

        cf.addInterface(Runnable.class);
        cf.addInterface(Serializable.class);

        cf.addField("_map", Map.class);

        cf.addConstructor(new Class[]
        { Map.class, Runnable.class }, new Class[]
        { IllegalArgumentException.class, DataFormatException.class }, "{ _map = $1; }");
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

                    adapter.getType(),
                    propertyType));

        ClassFab cf = _classFactory.newClass(propertyType);

        cf.addField("_source", sourceClass);

        cf.addConstructor(new Class[]
        { sourceClass }, null, "_source = $1;");

        String body = format("return _source.%s();", adapter.getReadMethod().getName());
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

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.