Package org.apache.tapestry5.ioc.services

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


    @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>");

        ToStringService delegate = new ToStringService()
View Full Code Here


    {
        ServiceProxyToken token = SerializationSupport.createToken(serviceId);

        ClassFab classFab = registry.newClass(serviceInterface);

        classFab.addField("creator", Modifier.PRIVATE | Modifier.FINAL, ObjectCreator.class);
        classFab.addField("token", Modifier.PRIVATE | Modifier.FINAL, ServiceProxyToken.class);

        classFab.addConstructor(new Class[]
        { ObjectCreator.class, ServiceProxyToken.class }, null, "{ creator = $1; token = $2; }");
View Full Code Here

        ServiceProxyToken token = SerializationSupport.createToken(serviceId);

        ClassFab classFab = registry.newClass(serviceInterface);

        classFab.addField("creator", Modifier.PRIVATE | Modifier.FINAL, ObjectCreator.class);
        classFab.addField("token", Modifier.PRIVATE | Modifier.FINAL, ServiceProxyToken.class);

        classFab.addConstructor(new Class[]
        { ObjectCreator.class, ServiceProxyToken.class }, null, "{ creator = $1; token = $2; }");

        // Make proxies serializable by writing the token to the stream.
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.

            // The arguments may be wrapper types, so we cast down to
            // the primitive type.
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.

            // The arguments may be wrapper types, so we cast down to
            // the primitive type.
View Full Code Here

            String fieldName = "_param_" + i;

            constructorParameterTypes[i + 1] = argType;
            constructorParameterValues[i + 1] = arg.value;

            cf.addField(fieldName, fieldType);

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

            // The arguments may be wrapper types, so we cast down to
            // the primitive type.
View Full Code Here

    {
        ServiceProxyToken token = SerializationSupport.createToken(serviceId);

        ClassFab classFab = registry.newClass(serviceInterface);

        classFab.addField("creator", Modifier.PRIVATE | Modifier.FINAL, ObjectCreator.class);
        classFab.addField("token", Modifier.PRIVATE | Modifier.FINAL, ServiceProxyToken.class);

        classFab.addConstructor(new Class[]
        { ObjectCreator.class, ServiceProxyToken.class }, null, "{ creator = $1; token = $2; }");
View Full Code Here

        ServiceProxyToken token = SerializationSupport.createToken(serviceId);

        ClassFab classFab = registry.newClass(serviceInterface);

        classFab.addField("creator", Modifier.PRIVATE | Modifier.FINAL, ObjectCreator.class);
        classFab.addField("token", Modifier.PRIVATE | Modifier.FINAL, ServiceProxyToken.class);

        classFab.addConstructor(new Class[]
        { ObjectCreator.class, ServiceProxyToken.class }, null, "{ creator = $1; token = $2; }");

        // Make proxies serializable by writing the token to the stream.
View Full Code Here

    private Class constructThunkClass(Class interfaceType)
    {
        ClassFab classFab = classFactory.newClass(interfaceType);

        classFab.addField(DESCRIPTION_FIELD, PRIVATE_FINAL, String.class);

        classFab.addField(CREATOR_FIELD, PRIVATE_FINAL, ObjectCreator.class);

        classFab.addConstructor(new Class[] { String.class, ObjectCreator.class }, null,
                                String.format("{ %s = $1; %s = $2; }", DESCRIPTION_FIELD, CREATOR_FIELD));
View Full Code Here

    {
        ClassFab classFab = classFactory.newClass(interfaceType);

        classFab.addField(DESCRIPTION_FIELD, PRIVATE_FINAL, String.class);

        classFab.addField(CREATOR_FIELD, PRIVATE_FINAL, ObjectCreator.class);

        classFab.addConstructor(new Class[] { String.class, ObjectCreator.class }, null,
                                String.format("{ %s = $1; %s = $2; }", DESCRIPTION_FIELD, CREATOR_FIELD));

        MethodSignature sig = new MethodSignature(interfaceType, DELEGATE_METHOD, null, null);
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.