Java Beans, as far as I know, should always:
- Have only an empty constructor
- Have only fields, and getter/setter methods for these fields.
However, I am wondering what the convention is for Java beans to implement interfaces like Comparable
? I could leave the java bean pure, meaning absolutely no behaviour, only data, and write a custom comparator-class. Implementing comparable is easier though.
Are there any conventions when it comes to implementing simple common interfaces like Comparable to Java Beans? I cannot find any consequences myself, but it feels like I might breaking some rules, and that there might be something I haven't thought of.