java - Regexp to compact default method implementations in Eclipse -
I use Eclipse Galileo to develop Java code while implementing an interface for joke, I want to specify the behavior of the methods and mostly want to keep the default behavior (nothing or empty zero / 0). Eclipse will produce a well-formatted default implementation such as:
HTTPSvRTuQVTMOC = new HTTPServativeTystem () {public string getQueryString () {return "FOBOOR"; } Public Zero SetActivate (String RGR, Object AGR1) {// TODO Auto-Generated Method Stub} Public Inc getServerPort () {// TODO Auto generated method stub returns 0; } Public string getServerName () {// TODO auto generated method stub returns empty; } ... for the puribilili and cleanliness, I'm looking for a regxp (search / substitute search of eclipse) to release it, This will produce the following code while running the following code: HttpServletRequest mock = new HttpServletRequest () {public string getQueryString () {return "foobar"; } Public Zero Set Attribute (String RGR, Object AG 1) {} Public Intensarport () {Return 0;} Public String getServerName () {Return Null;} ... etc ...
Basically:
-
{and}
-
Delete any of the four / new lines / tabs, But "return (. *);" If there is such a thing (there is no return statement in zero ways)
It is OK to check each place and those I want to keep Leave them
I did something like this:
- Pattern Find:
(public | private | secure) \ s + (\ w +) \ s + (\ w +) (\ (. * \)) \ S + \ {\ s * (// TODO auto- Created method stub): Change the pattern:
$ 1 $ 2 $ 3 $ 4 {$ 6}
Comments
Post a Comment