University of Cincinnati logo and link  
Designing a JavaBean
 
  UC ingot A JavaBean can be any Java class; you just have to keep a few things in mind.
 
  • First, consider the properties of the bean.  These need to be accessed via getter and setter methods.  Properties can be an aggregation of instance fields or attributes; they do not need to have a 1:1 relationship.
  • A bean should be able to be used in many situation, and by novice programmers. Thus, keep flexibility and user-friendliness in mind when designing your bean.  Perhaps provide default behaviors that can be changed with property settings.
  • Beans often have the default constructor, whether it is specifically written or provided when no other constructor is provided.
 Starting a JavaBean