Change field access to getter / setter method access

Posted by Chris Dennett on Stack Overflow See other posts from Stack Overflow or by Chris Dennett
Published on 2010-04-25T20:56:51Z Indexed on 2010/04/25 21:03 UTC
Read the original article Hit count: 382

Filed under:
|
|
|

Hi everyone, is it possible to change external class field accesses in Java to getter / setter calls automatically, and also hide the exposed fields? I'm using Javabeans and I want change notifications when a field property changes (this is important). I've found cglib which can automatically insert the property change call to the PropertyChangeSupport field.

I'd like this question to be a discussion of the issues posed and their solutions. I know about Project Lombok, but this appears to modify the source code, and additionally doesn't support field access modification. Perhaps with modifications to Lombok, this could be supported, or are there other solutions?

Cheers and thanks in advance, Chris

© Stack Overflow or respective owner

Related posts about java

Related posts about getters