so, if I understand your question correctly:
you want, if you create a method:
public int addTwoIntegers(int one, int two){
}
your IDE to automatically generate something like:
public int addTwoIntegers(int one, int two){
return one + two;
}
??
how do you think to do something like this?
just because the methodname and params
public int addTwoIntegers(int one, int two)
are perfectly clear for you, your compiler/IDE/... will NOT know what you want it to do (what logic you want in it) or what it means until you actually code that logic. To the compiler, this is just a methodname that needs to follow certain rules: either static or return-type, followed by (<params here>) and a block of code between brackets, ...
So, unless you come up with a very impressive AI, teach it to understand the language in which you code AND teach it all the logic you'll ever use, I doubt you'll have much success implementing such an option.
naturally, I could have misunderstood your question.
stultuske
Industrious Poster
4,382 posts since Jan 2007
Reputation Points: 1,318
Solved Threads: 610
Skill Endorsements: 24
Eclipse's add unimplemented methods is a helper that kicks in when you declare a class that implements an interface or extends an abstract class but doesn't have all the necessary methods. The helper adds stub (empty) methods for all the missing methods. It's particularly useful when creating anonymous inner classes for Swing listeners.
pankajagar: what are the "conditions" and kind of code do you want to generate here?
JamesCherrill
... trying to help
8,527 posts since Apr 2008
Reputation Points: 2,583
Solved Threads: 1,456
Skill Endorsements: 30
implement the code like that and you won't be able to compile your code.
Start logging and End loggin.
are these supposed to be comments, method calls, .. ?
stultuske
Industrious Poster
4,382 posts since Jan 2007
Reputation Points: 1,318
Solved Threads: 610
Skill Endorsements: 24
Maybe you should be using abstract classes rather than interfaces and defining that common code in the abstract superclass?
JamesCherrill
... trying to help
8,527 posts since Apr 2008
Reputation Points: 2,583
Solved Threads: 1,456
Skill Endorsements: 30
That does sound like a case for inheriting those "skeleton" methods, Maybe using this pattern:
public void doSomeNewStuff() { // this is a new method that others will call
openConnection();
logStuff();
doSomeNewStuffImplementation();
closeConnection();
}
abstract protected void doSomeNewStuffImplementation(); // this is where subclasses implement their own stuff
JamesCherrill
... trying to help
8,527 posts since Apr 2008
Reputation Points: 2,583
Solved Threads: 1,456
Skill Endorsements: 30
unless your IDE "understands" the names of your methods and your intention, I don't see how to do something like that, if not in a way like JamesCherrill suggested.
stultuske
Industrious Poster
4,382 posts since Jan 2007
Reputation Points: 1,318
Solved Threads: 610
Skill Endorsements: 24
Its also help me if anyone tell me the way to find the list of unimplmented method in class file. For example if Class A implementing interface B then i want the list of unimplmented method of Class A.
Eclipse will generate an error in that case, and can add the method headers/stubs for any/all missing methods, so you can see exactly what they are.
JamesCherrill
... trying to help
8,527 posts since Apr 2008
Reputation Points: 2,583
Solved Threads: 1,456
Skill Endorsements: 30