Introduction
POJO (Plain Old Java Object), basically a class with attributes and it’s getters and setters. The name is used to emphasise that a given object is an ordinary Java Object, not a special object.
Why used in android?
POJO is mainly used to denote a Java object which does not follow any of the major Java object models, conventions, or frameworks. Mainly used in Restful API web-services.
Example
Initialize :
POJO (Plain Old Java Object), basically a class with attributes and it’s getters and setters. The name is used to emphasise that a given object is an ordinary Java Object, not a special object.
Why used in android?
POJO is mainly used to denote a Java object which does not follow any of the major Java object models, conventions, or frameworks. Mainly used in Restful API web-services.
Example
Initialize :
public Test(String id, String name) {
this.name = name;
this.id = id;
}
Getter : public String getName() {
return name;
}
Setter : public void setName(String name) {
this.name = name;
}
Calling from Activity : Test pojo = new Test("001" , "Kumar"};
0 comments:
Post a Comment