Javabean 101 4

zhaozj2021-02-11  233

Basic concept of bean

The JavaBean is defined by the following features without considering its function.

Self-test-Bean supports self-test, and self-test allows constructors to analyze how Bean work. Self-test This process follows rules called design patterns, design patterns for naming the characteristics of Beans. Each bean has a related Bean Information class that provides properties, methods, and event information about Bean itself. Each Bean Information class implements the BeanInfo interface that specifically lists the features of Beans that need to be known to make the construction tool. Attribute - property controls the appearance and behavior of Bean. The constructor performs self-test to find its properties and display these attributes for operation. You can change the properties of the bean during the design phase. Configuration - Once the properties of the bean are displayed, you can set in the design phase. Users can change the appearance and behavior of Beans. BEAN can be set by using an attribute editor or a special, complex Bean settinger. Event -Bean communicates with other beans through an event. Bean can generate an event, that is, send an event to another bean. Bean, sending event, called source bean. The bean that receives the event is called a listening bean. A monitoring bean monitors the event sent from the source bean. The constructor uses the self-test process to understand the event sent by the bean and events accepted by the bean. Continuous -Bean uses Java object serialization, implements Java.io.Serializable interfaces for saving and recovering configuration results. For example, when you set a bean in the application constructor, the original state will be saved, and the state that is changed can be recovered. Method - All methods in all JavaBeans are the same as other Java classes, and the bean method can be called by other beans, or can be called in scripting language. The method in javabean is public in the default.

In general, Bean seems to be mainly used for construction tools. The actual situation is not necessarily, and beans can be manually operated by text tools by programming interfaces. Like constructor, all key APIs, including support for events, attributes, and persistence, are designed to be read and understood by programmers.

If you use Javabean for the first time, use the BDK's beanbox. Although in this tutorial, we used Beanbox to create a JavaBean, beanbox usually, is used to test JavaBean. Beanbox is considered a reference constructor environment. It is neither used to construct a GUI application, which is also different from constructor such as Visual Age, Delphi, or Visual Basic.

You can create a javabean first, then use beanbox to test whether it is running normally. If a JavaBean runs normally in Beanbox, you can confine it to work in other commercial constructors.

转载请注明原文地址:https://www.9cbs.com/read-4771.html

New Post(0)