-
1. Re: Proxy Based POJOs (No AOP) in POJO Cache
belaban Oct 5, 2007 1:31 AM (in response to jason.greene)I don't like this approach, as it defeats the uniformity of byte code instrumentation. I always disliked that - although we do instrument user classes - we cannot do the same for collections, so that's where we use AOP proxies.
I'd prefer a uniform approach. Having to writter getters and setters in one case and being able to use complete POJOs in another is cumbersome IMO. -
2. Re: Proxy Based POJOs (No AOP) in POJO Cache
manik Oct 5, 2007 4:26 AM (in response to jason.greene)Wasn't JBoss AOP going to offer generated proxies as an alternative to manipulating bytecode at some point? Is this already there? Or am I completely off the mark? :-)
I think having options is always valuable. The JavaBean standard is not a huge deal - I think people should follow this anyway. -
3. Re: Proxy Based POJOs (No AOP) in POJO Cache
belaban Oct 5, 2007 6:26 AM (in response to jason.greene)"manik.surtani@jboss.com" wrote:
I think having options is always valuable. The JavaBean standard is not a huge deal - I think people should follow this anyway.
Why ? I never liked the JavaBeans approach, where even internal methods need to call accessors, like
public int increment() {
int retval=getAge();
setAge(retval +1);
return retval
}
instead of
public int increment() {
return age++;
} -
4. Re: Proxy Based POJOs (No AOP) in POJO Cache
jason.greene Oct 5, 2007 7:57 PM (in response to jason.greene)"bela@jboss.com" wrote:
I don't like this approach, as it defeats the uniformity of byte code instrumentation. I always disliked that - although we do instrument user classes - we cannot do the same for collections, so that's where we use AOP proxies.
I'd prefer a uniform approach. Having to writter getters and setters in one case and being able to use complete POJOs in another is cumbersome IMO.
Thanks for sharing your thoughts on this, to be honest, my initial reaction to this request was pretty much the same. I agree that the AOP approach is better. I also don't like introducing confusion, and I have a feeling that having to reget proxy objects after they are attached will do exactly that. However, if there is enough community demand for this, especially enough that someone is willing to submit the code to do it, provided the final patch looks good, and doesn't over complicate the code base, I'm ok with making some kind of option for it.
-Jason -
5. Re: Proxy Based POJOs (No AOP) in POJO Cache
jason.greene Oct 5, 2007 8:03 PM (in response to jason.greene)"manik.surtani@jboss.com" wrote:
Wasn't JBoss AOP going to offer generated proxies as an alternative to manipulating bytecode at some point? Is this already there? Or am I completely off the mark? :-)
Yes we already use them today for collections. Although it doesn't really matter what the proxy framework is.
I think having options is always valuable. The JavaBean standard is not a huge deal - I think people should follow this anyway.
Yeah this is common for domain models, so I think its workable. This does lead to some big pitfalls (anything remotely exotic breaks) if you don't expect it, so it would most definitely not be the default behavior, and it would have to be documented.
-Jason -
6. Re: Proxy Based POJOs (No AOP) in POJO Cache
vincent.marquez Oct 11, 2007 5:52 PM (in response to jason.greene)For the precedence issue, we could identify if a class followed the 'JavaBean' standard when we initially construct a CachedType for it.
Since the CachedType objects are cached, there would only be a slight performance impact the first time an unrecognized class is attached.
So, the precedence rules would be: first check if object is advisable, then check if it is a collection, then check if it follows standard javabean symantics, and finally use the serializable handler. -
7. Re: Proxy Based POJOs (No AOP) in POJO Cache
jason.greene Oct 26, 2007 4:22 PM (in response to jason.greene)"vincent.marquez" wrote:
So, the precedence rules would be: first check if object is advisable, then check if it is a collection, then check if it follows standard javabean symantics, and finally use the serializable handler.
Yeah this is reasonable. The problem is that someone might actually prefer the serializable mode with a class that is a javabean, or looks like one. This is a significant behavior change that likely should merit some kind of configuration value (something like proxyJavaBeans).
-Jason -
8. Re: Proxy Based POJOs (No AOP) in POJO Cache
vincent.marquez Nov 2, 2007 2:33 PM (in response to jason.greene)Ok, the config value is something I can add. I didn't see a JIRA issue for this so if its alright with everyone i'll go ahead and add it, then post a patch to it for review.
-
9. Re: Proxy Based POJOs (No AOP) in POJO Cache
jason.greene Nov 3, 2007 3:07 AM (in response to jason.greene)Cool. I went ahead and created one for you here:
http://jira.jboss.com/jira/browse/PCACHE-54