Bug 204047 - [source generation] Generate Comparable implementation
Summary: [source generation] Generate Comparable implementation
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2007-09-19 18:25 EDT by Mike M CLA
Modified: 2010-11-04 06:46 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike M CLA 2007-09-19 18:25:40 EDT
Today we can generate equals() and hashCode() implementations for classes.  I suggest adding a feature that would add "implements java.lang.Comparable<X>" to the class (if not already present) and generate implementation code for the compareTo() method.  A dialog would allow the selection of which member variables should be pertitent, just like we have for the equals/hashCode generator today.

A question for debate: should we provide an option as to whether the Comparable interface used is genericized or not?  Either way, should we allow the user to specify what the type parameter is, or always use the current class type?  Or instead of allowing any old type, allow the user to choose a type from the class' inheritance ancestry.
Comment 1 Olivier Thomann CLA 2007-09-19 20:01:45 EDT
Move to JDT/UI