What is a JavaBean exactly?

Technology CommunityCategory: JavaWhat is a JavaBean exactly?
VietMX Staff asked 3 years ago

Basically, a “Bean” follows the standart:

  • is a serializable object (that is, it implements java.io.Serializable, and does so correctly), that
  • has “properties” whose getters and setters are just methods with certain names (like, say, getFoo() is the getter for the “Foo” property), and
  • has a public 0-arg constructor (so it can be created at will and configured by setting its properties).

There is no syntactic difference between a JavaBean and another class – a class is a JavaBean if it follows the standards.