tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lance Java <lance.j...@googlemail.com>
Subject Re: tapestry-ioc & java 8
Date Tue, 20 May 2014 07:42:42 GMT
Tapestry has switched to plastic for its byte code magic. Currently,
plastic isn't well documented. I find that the best documentation currently
is the test cases. Perhaps you can find your answer here:

https://github.com/apache/tapestry-5/tree/master/plastic/src/test/groovy/org/apache/tapestry5/plastic
 On 19 May 2014 23:46, "Jigar Joshi" <jigarjm@gmail.com> wrote:

> Hello
>
> ​with tapestry 5.3.4 and java 7 with use of
> org.apache.tapestry5.ioc.services.ClassFactory
>
>
>
>     private Class<?> createProxyClass(ServiceResources resources) {
>         Class<?> serviceInterface = resources.getServiceInterface();
>
>         ClassFab cf = classFactory.newClass(serviceInterface);
>
>         // add field
>         cf.addField("_creator", Modifier.PRIVATE | Modifier.FINAL,
> SomeClass.class);
>
>         // Constructor takes a ServiceCreator
>         cf.addConstructor(new Class[] { SomeClass.class }, null, "_creator
> = $1;");
>
>         // add method
>         String body = format("return (%s) _creator.get();",
> serviceInterface.getName());
>         MethodSignature sig = new MethodSignature(serviceInterface,
> SCOPE_METHOD_NAME, null, null);
>         cf.addMethod(Modifier.PRIVATE, sig, body);
>         String toString = format("<Scoped Proxy for scope(%s): %s(%s)>",
> scope, resources.getServiceId(),
>                 serviceInterface.getName());
>
>         cf.proxyMethodsToDelegate(serviceInterface, SCOPE_METHOD_NAME +
> "()", toString);
>
>         return cf.createClass();
>     }
>
>
>
>
>
> with tapestry 5.4-beta3 this class has been removed (it was depricated)
>
> I played around a little bit to find related implementation in new replaced
> class
>
> org.apache.tapestry5.ioc.services.PlasticProxyFactory
>
> couldn't find it offhand, how to achieve same thing with tapestry 5.4 ?
>
> Thanks!
> Jigar
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message