The jde-gen-get-set function produces accessor/mutator methods that are
99% in compliance with the naming convention for javabeans.  Where they
fall short is in generating accessor methods for boolean fields.
These are supposed to be written thusly:

public boolean isActive () { return mActive; }

but the jde-gen-get-set function yields

public boolean getActive () { return mActive; }

The following lisp defun will do the right thing for all accessor methods.
I suggest that it be folded into the next release of jde-gen.el, and
offer it here for interim use.

(defun jde-gen-accessor-name (type name)
  "Returns a javabeans-compliant accessor method name for type+name."
  (if (string-equal type "boolean")
      (concat "is" (jde-gen-init-cap name))
      (concat "set" (jde-gen-init-cap name))
  ))

it can be invoked in the template definition for get-set by replacing
"set" (jde-gen-init-cap (jde-gen-lookup-named 'name))

with

(jde-gen-accessor-name (jde-gen-lookup-named 'type) (jde-gen-lookup-named 'name))

Cheers,
Eric Friedman

Reply via email to