More complex bean support

Source: Internet
Author: User
Tags naming convention

We can see how simple it is to create a bean. We have little restrictions on programming. The Java bean design provides a simple input point that can be raised to a more complex level. These high-level issues are beyond the scope of the book, but they will be briefly introduced here. We can find more details on the Http://java.sun.com/beans.
We add more complex programs and its properties to a location. The example above shows a unique attribute, which, of course, can represent an array of properties. This is called an indexed property. We simply provide a corresponding method (plus a naming convention for a method name) and introspector the indexed property, so our Application Builder tool handles it accordingly.
Attributes can be bundled, which means that they will notify other objects via propertychangeevent. Other objects can then modify themselves according to the changes to the bean.
Attributes can be bound, which means that other objects can reject a property when a change cannot be accepted. Other objects use a propertychangeevent to notify, and they produce a proptertyvetoexception to prevent the change from occurring and revert to the original value.
We can also change the way our bean is portrayed at design time:
(1) We can provide a custom property sheet for our special bean. This normal property sheet will be used by all beans, but it will automatically call this property sheet when our bean is selected.
(2) We can create a custom editor for a particular attribute, so the normal property sheet is used, but the editor is invoked automatically when the property we specify is invoked.
(3) We can provide a custom beaninfo class for our bean, and the resulting information is different from the default generated by Introspector.
(4) It is also possible to change the "expert" switch mode in all featuredescriptors to identify basic features and more complex features.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.