I¹m not sure if this has been discussed/posted but a search at the current
groups forum returned no result and I¹m not sure how to access/search the
previous maillist or even if it is possible.

If you are a Java programmer with a need to create JavaBeans this may speed
development slightly.  The following is a means to rapidly create
setter/getter accessor methods using Find/Replace (much faster/more
integrated than using Unix scripts etc.).

1) First create your class structure and properties

    public class MyClass
    {

    private String prop1;
    private Integer prop2;
    private boolean prop3;
    ...

2) Copy/paste the properties you want accessor methods for

    public class MyClass
    {

    private String prop1;
    private Integer prop2;
    private boolean prop3;

    /*** Setter/Getter methods ***/
    private String prop1;
    private Integer prop2;
    private boolean prop3;
  ...

3) Hilight the pasted properties and run the following Find/Replace All grep
    statement on the Selected text only.

    Find: private (\w+) (\w)(\w+).*
    
    Replace: \tpublic void set\u\2\3( \1 T )\r\t{\r\t\tthis.\2\3 =
T;\r\t}\r\tpublic \1 get\u\2\3()\r\t{\r\t\treturn \2\3;\r\t}

This will replace the hilighted properties with:

    public void setProp1( String T )
    {
        this.prop1 = T;
    }
    public String getProp1()
    {
        return prop1;
    };
    public void setProp2( Integer T )
    {
        this.prop2 = T;
    }
    public Integer getProp2()
    {
        return prop2;
    };
    public void setProp3( boolean T )
    {
        this.prop3 = T;
    }
    public boolean getProp3()
    {
        return prop3;
    };


If you have Beans with more than a few properties this can save you real
time.  You can tweak and save it for just setters or for more advanced
accessor creation (e.g. change listeners).

The output is formatted for my coding style and you may want to tweak the
output.

have fun!

Steven



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "BBEdit Talk" 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/bbedit?hl=en
If you have a specific feature request or would like to report a suspected (or 
confirmed) problem with the software, please email to "[EMAIL PROTECTED]" 
rather than posting to the group.
-~----------~----~----~----~------~----~------~--~---

Reply via email to