简体   繁体   中英

Client-side AOP options for GWT apps

It would be nice to be able to define my own method interceptors (advice) and weave them in to my client-side GWT methods, and have GWT automagicallly compile them down into JavaScript with the rest of my app.

I checked out gwt-ent , but it doesn't look like there's been solid development on it since 2009 and there were quite a number of issues. I've also heard of gwt-tiny-aop but heard it was very limited.

Do I have any other options here? I know AOP requires dynamic bytecode generation, which in turn requires heavy reflection, and that GWT doesn't contain a lot of support (and seems to discourage) the practice of reflection, but I was wondering if there are any stable, well-known AOP libs out there for GWT. At least something that I could use for writing AOP Alliance-like interceptors:

public class MyInterceptor implements MethodInterceptor {
    @Override
    public void onIntercept(MethodInvocation mi) {
        // Do some stuff...

        // Let the method execute
        Object results = mi.proceed();

        // Analyze results...

        // Returns results
        return results;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM