Extract Interface (I)
11 March 2008Eclipse provides the possibility to extract interface from a class. You may call it reverse engineering since rule of thumb is to write the interface first and then write the classes implementing it. But sometimes, it’s the other way around. You write a class and then you want to generate the appropriate interface for it. Lets see how to do this.
I wrote a class that has to do with text extraction from CSV files. I named it CSVFile.
import java.util.ArrayList; public class CSVFile { public static void main(String[] args) { } public ArrayList extractHeader() { return null; } public int getNoOfRows() { return 0; } public ArrayList extractContents() { return null; } }
Then I realized that I should have an interface for it as well. Concourse, I can simply write it, but I am looking for an easy way. Thankfully I am using Eclipse and it supports this thing.
Refer to the next post on this topic to learn how to do this.
Related Posts:
- Extract Interface (II)
- Generating Interface from a Class
- Extract superclass(II)
- An interface extending an interface(II)
- Behavioral Pattern - Iterator Pattern (Example) - 1
- Using interfaces in APIs - I
- Using interfaces in APIs - II
- An interface extending an interface(I)
- Extract superclass(I)
- Interface extending Interface
Top Of Page | Trackback
If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.
It will look like this: Extract Interface (I)