Unfortunately this question is specific to Java only, because the
majority of us have to write Java classes professionally (as in making
a living).
In Eclipse , there are code templates for creating
getter body
return $(field)
setter body
${field} = ${param}
However it is not flexible enough to retrofit a Bond Trade class with
50 properties or so.
Also in Eclipse, you edit the Code Templates, however there is no way
to add a new one or remove an old one.
For NetBeans
There no such customisation of templates in their equivalents.
NetBeans could do more with powerful dialogs to set the accessibility.
One thing I would love to see in NetBeans in created Java types, is to
choose the super classes and add any additional interfaces in the same
way Eclipse does.
It looks like another case for using the JavaReflection API and ---
drum roll -- a quick Groovy Script to code generate. If memory
serves :
def className = "BondTrade"
def methods = Class.for(className).declaredMethods.grep ( /set/ , { m
->
if ( !m.isInterface() && !m.isAbstract() && m.paramaters.size ==
1 ) {
out.println """
public ${className} ${method}( $
{m.parameters[0].class.getName} v0 ) {
this.${m.parameters[0].name} = v0;
return v0;
"""
}
}
It would take probably a few hours / maybe a day to knock up a groovy
script, but you can see I would have the IDE plugin.
On 12 Oct, 16:22, Peter A Pilgrim <[email protected]> wrote:
> Hi Everyone
>
> May be even Tor can help.
>
> Has anyone come across a name value pattern plugin for NetBeans or
> Eclipse IDE?
> Given a class like this:
>
> class Node {
> private float x;
> private float y;
> private float z;
>
> }
>
> The plugin generates the accessors and builder chain mutators
>
> class Node {
> private float x;
> private float y;
> private float z;
>
> public float getX() { return x; }
> public Node setX( float x ) { this.x = x; return this }
> public float getY() { return x; }
> public Node setY( float y ) { this.y = y; return this }
> public float getZ() { return z; }
> public Node setZ( float z ) { this.z = z; return this }
>
> }
>
> TIA
--
You received this message because you are subscribed to the Google Groups "The
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/javaposse?hl=en.