What is java pojo class, java bean, normal class? [duplicate]
Normal Class
: A Java class-
Java Beans
:- All properties private (use getters/setters)
- A public no-argument constructor
- Implements Serializable.
-
Pojo
: Plain Old Java Object is a Java object not bound by any restriction other than those forced by the Java Language Specification. I.e., a POJO should not have to- Extend prespecified classes
- Implement prespecified interface
- Contain prespecified annotations
POJO stands for Plain Old Java Object, and would be used to describe the same things as a "Normal Class" whereas a JavaBean follows a set of rules. Most commonly Beans use getters and setters to protect their member variables, which are typically set to private and have a no-argument public constructor. Wikipedia has a pretty good rundown of JavaBeans: http://en.wikipedia.org/wiki/JavaBeans
POJO is usually used to describe a class that doesn't need to be a subclass of anything, or implement specific interfaces, or follow a specific pattern.
POJO = Plain Old Java Object. It has properties, getters and setters for respective properties. It may also override Object.toString()
and Object.equals()
.
Java Beans : See Wiki link.
Normal Class : Any java Class.