I have read about EJB, Java Beans , however i still have doubts about what term "bean" in itself means?
A) Does the plain term "bean" exist in itself?
B) Now coming to Java Beans. As i read, it is just a plain POJO which follow some naming convention, and have getter and setters? However i have difficulty in understanding how does this convention make them as "reusable components", as i read in many posts including SO.
There are some SO posts similar to this, however it is different in that: I am asking if plan term "bean" exists; and how come java beans are reusable components.
Could someone please clarify this in simple terms.
The plain term "bean" is frequently used as as a shortcut to JavaBean or Enterprise Java Bean (depending on the context). So, the term exists in the common language of programmers and it refers in general to reusable objects/components in Java.
JavaBean is a POJO class with specific naming conventions for getters and setters, true and not only that: it is usually an encapsulation of other objects (properties), is serialisable and with a zero-argument constructor. There is a complete specification developed by Sun (at that moment) about JavaBean. Sun defined it as "a reusable software component that can be manipulated visually in a builder tool". Moreover, in JavaBean Specification it is stated that:
Individual Java Beans will vary in the functionality they support, but the typical unifying features that distinguish a Java Bean are:
The essential part is that can be visually manipulates hence the need for getters/setters, events, zero-argument constructor (so that they can be externally instantiated), serialisable.
Check this link for more details: http://download.oracle.com/otn-pub/jcp/7224-javabeans-1.01-fr-spec-oth-JSpec/beans.101.pdf?AuthParam=1435694253_b87821c280430a0230bf8d22223c79d2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With