Introduction

  • JavaBeans is developed by Sun Microsystems and released in 1996, as part of JDK 1.1.
  • The meaning of ‘beans’ in JavaBeans are classes that encapsulate one or more objects into a single standardized object (called the bean, here Bean is class and seeds of bean are objects). This bean finally allows easier code reuse and introspection (a process of analyzing a Bean to determine its capabilities)and treated as software components, and to be manipulated visually by builder tools such as editors and IDEs without needing any initial configuration. 
  • It’s still technically used as the standard server-side implementation toolset for JavaEE.

Definition

  • Java Beans is a Java technology and are reusable software component (model) which allow a great flexibility and additional features in the existing piece of software.
  • Java Bean is a class in which we can encapsulate many related objects into a single standardized object.

Features

  • The JavaBeans functionality is provided by a set of classes and interfaces in the java.beans package.
  • Individual Java Beans varies in its functionality, but most  beans share certain common defining features with other objects.
  • The JavaBeans class components can be labelled as methods, events, properties
  • All beans support serialization and have a zero-argument constructor.
  • An essential feature of JavaBeans is introspection that allows a builder tool to analyze how a bean works. 
  • Builder Tool –
    • Bean Box –
      • BeanBox is a utility from the Java Beans Development Kit (BDK). Basically the BeanBox is a test container for your JavaBeans. It is designed to allow programmers
        to preview how a Bean created by user will be displayed and manipulated in a builder
        tool. The BeanBox is not a builder tool.It allows programmers to preview how a bean
        will be displayed and used by a builder tool.It allows programmers to preview how a bean will be displayed and used by a builder tool.

Advantages

  • Java Beans support reusability characteristics, enables object communication, platform-independent, shorter time consumption, requires lesser manual efforts etc.
  • The configuration settings of a bean can be saved to persistent storage(persistence is the ability to save the current state of a Bean, including the values of a Bean’s properties and instance variables, to nonvolatile storage and to retrieve them at a later time) and restored when needed.
  • A Bean can generate required properties, events, and methods in one object and can be sent to other objects/another application as per need.
    • Support for events allowing beans to fire events, and informing builder tools about both the events they can fire and the events they can handle.
    • Support for properties allowing beans to be manipulated programmatically, as well as to support the customization mentioned above.
    • Support for persistence allowing beans that have been customized in an application builder to have their state saved and restored. Typically persistence is used with an application builder’s save and load menu any work that has gone into constructing an application.
  • Java Beans supports customization features that allows a user to alter the appearance and behaviour of a bean object as per requirement.

Disadvantages

  • JavaBeans are inherently mutable objects.

Use

  • Using the concept of JavaBeans in the Java program, we can encapsulate many related objects into a single object as per need, called a Bean.

Loading

Categories: Java

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.