I do not quite understand what a POJO object is so convenient for and how to understand that it is a POJO.
By definition, this is an object that does not expand anything, does not implement anything and does not have a constructor, all private variables + getters and setters ... Just such a simple object.
So, if I understand correctly, that if we allow a constructor to be thrown from this class, is it already POJO?
public final class CardFriend { private String friendName; private String friendPhoneNumber; private Bitmap friendPhotoBitmap; private String friendEmail; private String Uid; private int chanel; public CardFriend(String friendName, String friendPhoneNumber, Bitmap photoBitmap, String friendEmail, int chanel) { this.friendPhotoBitmap = photoBitmap; this.Uid = "test"; if (friendName == null){ this.friendName = States.NO_NAME; }else { this.friendName = friendName; } if (friendPhoneNumber == null){ this.friendPhoneNumber = States.WITHOUT_PHONE_NUMBER; }else { this.friendPhoneNumber = friendPhoneNumber; } if (friendEmail == null) { this.friendEmail = States.WITHOUT_EMAIL; } else { this.friendEmail = friendEmail; } this.chanel = chanel; } public String getFriendName() { return friendName; } public String getFriendPhoneNumber() { return friendPhoneNumber; } public Bitmap getFriendPhotoBitmap() { return friendPhotoBitmap; } public String getFriendEmail() { return friendEmail; } public int getChanel() { return chanel; } public String getUid() { return Uid; } } And I have not found, is it possible to use logical methods in such classes? Suppose some kind of calculation method.
Well, if anyone cites examples where such objects are best used (since it is not a dubious advantage to throw out the constructor and install the setters), then it will be completely clear))