javabeans - What is the convention with Java beans, and implementing interfaces like Comparable? -
javabeans - What is the convention with Java beans, and implementing interfaces like Comparable? -
java beans, far know, should always:
have empty constructor have fields, , getter/setter methods these fields.however, wondering convention java beans implement interfaces comparable
? leave java bean pure, meaning absolutely no behaviour, data, , write custom comparator-class. implementing comparable easier though.
are there conventions when comes implementing simple mutual interfaces comparable java beans? cannot find consequences myself, feels might breaking rules, , there might haven't thought of.
imho question not conventions needs.
you right separation of bean stuff business logic style. i'd add together here typically practice because relationship between beans , comparators many-to-many, i.e.
you hold several comparators 1 bean class , utilize them in different contexts sometimes can re-use 1 comparator several different classes or create hierarchy of comparators.however right writing comparing logic class less verbose , in cases preferable. selection depends on author taste , requirements of application he/she working on.
java javabeans conventions comparable
Comments
Post a Comment