java bean concept

 JavaBeans Concepts

The JavaBeans™ architecture is based on a component model which enables developers to create software units called components. Components are self-contained, reusable software units that can be visually assembled into composite components, applets, applications, and servlets using visual application builder tools. JavaBean components are known as beans.

A set of APIs describes a component model for a particular language. The JavaBeans API specificationdescribes the core detailed elaboration for the JavaBeans component architecture.

Beans are dynamic in that they can be changed or customized. Through the design mode of a builder tool you can use the Properties window of the bean to customize the bean and then save (persist) your beans using visual manipulation. You can select a bean from the toolbox, drop it into a form, modify its appearance and behavior, define its interaction with other beans, and combine it and other beans into an applet, application, or a new bean.

The following list briefly describes key bean concepts.

  • Builder tools discover a bean's features (that is, its properties, methods, and events) by a process known as introspection. Beans support introspection in two ways:
    • By adhering to specific rules, known as design patterns, when naming bean features. The Introspector class examines beans for these design patterns to discover bean features. The Introspector class relies on the core reflection API. The trail The Reflection API is an excellent place to learn about reflection.
    • By explicitly providing property, method, and event information with a related bean information class. A bean information class implements the BeanInfo interface. A BeanInfo class explicitly lists those bean features that are to be exposed to application builder tools.
  • Properties are the appearance and behavior characteristics of a bean that can be changed at design time. Builder tools introspect on a bean to discover its properties and expose those properties for manipulation.

     

  • Beans expose properties so they can be customized at design time. Customization is supported in two ways: by using property editors, or by using more sophisticated bean customizers.

     

  • Beans use events to communicate with other beans. A bean that is to receive events (a listener bean) registers with the bean that fires the event (a source bean). Builder tools can examine a bean and determine which events that bean can fire (send) and which it can handle (receive).

     

  • Persistence enables beans to save and restore their state. After changing a bean's properties, you can save the state of the bean and restore that bean at a later time with the property changes intact. The JavaBeans architecture uses Java Object Serialization to support persistence.

     

  • A bean's methods are no different from Java methods, and can be called from other beans or a scripting environment. By default all public methods are exported.

Beans vary in functionality and purpose. You have probably met some of the following beans in your programming practice:

  • GUI (graphical user interface)
  • Non-visual beans, such as a spelling checker
  • Animation applet
  • Spreadsheet application

出自:http://download.oracle.com/javase/tutorial/javabeans/whatis/index.html

尝试翻译:

JavaBean架构是基于能够让开发人员创建程序单元的组件模型。它是自包含的,可复用的单元。并且通过可视化的应用构建工具把它集成到复杂组件,applets,应用,servlets。JavaBean组件被人们以beans熟知。

一系列API对这一组件模型进行了描述。JavaBean API规范对JavaBean组件架构进行核心详细描述。

Beans是动态的,它们是可改变和可定制的。构建工具可以通过图形界面可视化操作构建bean和持久beans。你可以通过工具箱选择bean,把它放到form里,修改bean的表现和行为,定义它和其他bean的交互,合并它们,或者把它们整合到applet,应用中,或创建一个新的bean。

下面简单的列出了bean概念的关键:

   构建工具可以通过内省机制嗅探到bean的特征(如属性,方法,事件),bean通过两种方式支持内省机制:

       通过秉承特定的规则,如设计模式,来命名bean的特征。内省通过设计规则在发现特征。内省机制依赖于反射机制,相关的API是学习反射的好地方

       通过为bean明确的提供属性,方法,事件信息。这个bean实现了BeanInfo接口。BeanInfo能够准确的罗列出bean的特征并把它们暴露给应用构建工具

       十一回来再接着写。

      

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值