private void addGetterAndSetter ( JDefinedClass traversingVisitor , JFieldVar field ) { String propName = Character . toUpperCase ( field . name ( ) . charAt ( 0 ) ) + field . name ( ) . substring ( 1 ) ; traversingVisitor . method ( JMod . PUBLIC , field . type ( ) , "get" + propName ) . body ( ) . _return ( field ) ; JMethod setVisitor = traversingVisitor . method ( JMod . PUBLIC , void . class , "set" + propName ) ; JVar visParam = setVisitor . param ( field . type ( ) , "aVisitor" ) ; setVisitor . body ( ) . assign ( field , visParam ) ; }
Convenience method to add a getter and setter method for the given field .