一杆进洞叫什么球| 指甲上的月牙代表什么| 唐筛和无创有什么区别| 糕面是什么面| imax电影是什么意思| congee是什么意思| 黄疸严重会造成什么后果| 砗磲是什么| 伤官伤尽是什么意思| 月经褐色是什么原因| ca125是什么| 11号来月经什么时候是排卵期| 一直很困想睡觉是什么原因| 脂肪肝能吃什么水果| cr5是什么意思| 多元是什么意思| 山药跟淮山有什么区别| 海澜之家属于什么档次| 门诊号是什么意思| 人长寿的秘诀是什么| 没有什么过不去| 智商高的人有什么特征| 水蛭是什么| 小暑是什么意思啊| jc是什么牌子| 月经期吃什么水果好| 星光是什么意思| 厄运是什么意思| 白细胞低有什么症状| 油烟机没有吸力是什么原因| 晟这个字念什么| 泳帽什么材质的好| 吃山楂片有什么好处| 眼睛红血丝是什么原因| 胃溃疡十二指肠溃疡吃什么药| 什么蛇没毒| 什么是阳痿| 哈喇味是什么味道| 吃维c有什么好处| 什么飞扬| 嗝气是什么原因引起的| 螳螂捕蝉黄雀在后是什么生肖| 2007年是什么生肖| 自由奔放是什么生肖| 鹿晗和邓超什么关系| 看痣挂什么科| 腋毛上有白色附着物是什么| 桑黄是什么| 奥司他韦是什么药| 杳什么意思| fl是什么意思| 雷替斯是什么药| 气血不足吃什么食物好| 伤口溃烂不愈合用什么药| 乙肝不能吃什么东西| 什么食物容易消化| 口是心非是什么生肖| 钥字五行属什么| 什么是小暑| 促排药什么时候开始吃| 上次闰六月是什么时候| mmi是什么药| 不可思议的意思是什么| 截瘫是什么意思| 心律不齐是什么病| 白色加红色等于什么颜色| 肠炎吃什么药效果最好| 心眼小是什么意思| 莲子适合什么人吃| 丈青色是什么颜色| 运营商是什么意思| 925银什么意思| 龟头上抹什么药能延时| 大生化检查都包括什么项目| 明天有什么考试| 多吃丝瓜有什么好处和坏处| 血压高要吃什么蔬菜能降血压| 50公斤发什么物流便宜| 燕窝有什么营养价值| 宫颈炎是什么病| 即日是什么意思| 月结是什么意思| 云裳是什么意思| 什么茶叶好| rds是什么意思| 棉纺是什么面料| 天津古代叫什么| 人文是什么意思| 两横一竖是什么字| 什么样的白云| 互攻是什么意思| 献完血吃什么东西补血| 胃胀肚子胀吃什么药| 白细胞高是什么病| 上眼皮肿是什么原因| 外贸是什么| 江西特产有什么| 世界上最深的湖泊是什么| 出家需要什么条件| 荷兰的国花是什么花| 什么不安成语| 肛瘘是什么| 腹泻吃什么药最好| 吃什么食物补肾最快| 思维跳脱是什么意思| 脓毒症是什么病| 脑动脉硬化吃什么药| 湖南省的简称是什么| 什么年马月| 解析是什么意思| 脚背上长痣代表什么| 为什么眉毛会白| 疖肿什么意思| 女生胸部发育到什么年龄| 胃火牙疼吃什么药好| 芒果不能和什么水果一起吃| 男人前列腺炎有什么症状表现| 冠心病需要做什么检查| 为什么会脚臭| 古曼童是什么| 叶公好龙是什么生肖| 石五行属什么| 什么时候刮胡子最好| 北极熊为什么不怕冷| 九月二十八是什么星座| 什么是证件照| 齐博林手表是什么档次| 中国国鸟是什么鸟| 财多身弱什么意思| 莒姬是什么位分| 大骨头炖什么好吃| 肝在人体什么位置| 检查血常规挂什么科| 花生的种子是什么| 没有什么| 2月8日什么星座| 61是什么意思| 性功能障碍吃什么药| 阴囊瘙痒用什么药| 铁是补什么的| 十二生肖里为什么没有猫| 小孩子走神是什么原因| 6月12日什么星座| 总头晕是什么原因| 祈禳是什么意思| 龟吃什么| 10.30什么星座| 关节炎挂什么科| 部堂大人是什么职位| 考拉是什么意思| 盆腔积液是什么意思啊| 手电筒什么牌子的好| 走路不稳是什么原因| street是什么意思| 平身是什么意思| 梦见给别人剪头发是什么意思| 半年抛是什么意思| 车辙是什么意思| 自相矛盾是什么意思| 属猴和什么属相相克| 凿壁偷光是什么意思| 羊水破了什么感觉| 早上起来嘴苦口臭是什么原因| 前身是什么意思| 脚上有青筋是什么原因| 尿路感染用什么药| 皮肤过敏挂什么科| 蹲着有什么好处| 眼睛周围长脂肪粒是什么原因| 水逆退散是什么意思| 腰椎骶化是什么意思| 朱元璋为什么杀徐达| 射不出来是什么原因| 意什么深什么| 陈五行属什么| 隆鼻后吃什么消肿快| 血糖高的病人吃什么| 王五行属性是什么| 反射弧太长是什么意思| 丘疹性荨麻疹用什么药| 经常吃生花生有什么好处和坏处| 胃酸过多吃什么食物好| 两个立念什么| 大便一粒粒是什么原因| 遗精吃什么药| 吃什么拉什么是什么原因| 在家无聊可以干什么| 喷字去掉口念什么| 一个不一个好念什么| 肝血不足吃什么中成药| 照顾是什么意思| 藏毛窦挂什么科| 头皮痒用什么洗头好| 吃什么减肚子上的赘肉最快| 五指毛桃有什么作用| 白斩鸡是什么意思| 眉毛附近长痘痘是什么原因| simon是什么意思| 感知力是什么意思| 朝代表什么生肖| 子母环是什么形状图片| 杨字五行属什么| 筠字五行属什么| 长胸毛的男人代表什么| 鼻血流不停是什么原因| 四两拨千斤是什么意思| 热休克蛋白90a检查高是什么原因| copd什么意思| 深海鱼油的作用是什么| cathy是什么意思| 姨妈期可以吃什么水果| 采字五行属什么| 赫拉是什么神| 时间像什么| 青盐是什么盐| 凭什么是什么意思| 咳嗽吃什么药最好| 玫瑰花有什么作用| 东四命是什么意思| cc是什么| 主动权是什么意思| 氯超标是因为什么原因| 驾驶证c1和c2有什么区别| 低蛋白血症吃什么最快| 手指僵硬暗示什么疾病| 心口疼是什么原因引起的| 瓜田李下是什么意思| 大拇指指甲凹凸不平是什么原因| 什么叫转基因| 秋葵补什么| dha每天什么时候吃最好| 百香果什么季节成熟| 脚环肿是什么原因引起的| 胎儿宫内窘迫是什么意思| 重建是什么意思| 补铁的药什么时候吃最好| 处心积虑是什么意思| 房颤有什么症状| 梦见自己扫地是什么意思| 什么是阴沉木| 睡觉多梦吃什么药| 褥疮是什么| 吃什么对胃好养胃| 天秤座和什么星座最配| 江西的简称是什么| 普洱茶什么牌子好| 俄罗斯是什么洲| 胃出血恢复期吃什么好| 五脏六腑指什么| 尿黄是什么病| 什么水没有鱼| 舌头痛吃什么药好| lot是什么意思| 眼力见是什么意思| 乳房结节是什么原因引起的| 拼音b像什么| 1997年出生的属什么| 回头是岸是什么生肖| 右下腹是什么器官| 黛力新主治什么病| 迎春花像什么| 什么旺水命| 什么水果含维生素c最多| 肾的功能是什么| 百度

马兴瑞出席省环境保护督察整改工作领导小组会议。

(Redirected from Java Beans)
百度 不存在受牵连应严查关联交易之前,因为厚藤文化的法人是陈志军的妻子张桂英,于是,有不少认为,厚藤文化纯粹是受橙旗贷的牵连。

In computing based on the Java Platform, JavaBeans is a technology developed by Sun Microsystems and released in 1996, as part of JDK 1.1.

The 'beans' of JavaBeans are classes that encapsulate one or more objects into a single standardized object (the bean). This standardization allows the beans to be handled in a more generic fashion, allowing easier code reuse and introspection. This in turn allows the beans to be treated as software components, and to be manipulated visually by editors and IDEs without needing any initial configuration, or to know any internal implementation details.

As part of the standardization, all beans must be serializable, have a zero-argument constructor, and allow access to properties using getter and setter methods.

Features

edit
Introspection
Introspection is a process of analyzing a Bean to determine its capabilities. This is an essential feature of the Java Beans specification because it allows another application, such as a design tool, to obtain information about a component.
Properties
A property is a subset of a Bean's state. The values assigned to the properties determine the behaviour and appearance of that component. They are set through a setter method and can be obtained by a getter method.
Customization
A customizer can provide a step-by-step guide that the process must follow to use the component in a specific context.
Events
Beans may interact with the EventObject EventListener model.[clarification needed]
Persistence
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.
Methods
A Bean should use accessor methods to encapsulate the properties. A Bean can provide other methods for business logic not related to the access to the properties.

Advantages

edit
  • The properties, events, and methods of a bean can be exposed to another application.
  • A bean may register to receive events from other objects and can generate events that are sent to those other objects. [citation needed]
  • Auxiliary software can be provided to help configure a bean. [citation needed]
  • The configuration settings of a bean can be saved to persistent storage and restored. [citation needed]

Disadvantages

edit
  • A class with a zero-argument constructor is subject to being instantiated in an invalid state.[1] If such a class is instantiated manually by a developer (rather than automatically by some kind of framework), the developer might not realize that the class has been improperly instantiated. The compiler cannot detect such a problem, and even if it is documented, there is no guarantee that the developer will see the documentation.
  • JavaBeans are inherently mutable and so lack the advantages offered by immutable objects.[1]
  • Having to create getters for every property and setters for many, most, or all of them can lead to an immense quantity of boilerplate code.

JavaBeans API

edit

The JavaBeans functionality is provided by a set of classes and interfaces in the java.beans package.

Interface Description
AppletInitializer Methods in this interface are used to initialize Beans that are also applets.
BeanInfo This interface allows the designer to specify information about the events, methods and properties of a Bean.
Customizer This interface allows the designer to provide a graphical user interface through which a bean may be configured.
DesignMode Methods in this interface determine if a bean is executing in design mode.
ExceptionListener A method in this interface is invoked when an exception has occurred.
PropertyChangeListener A method in this interface is invoked when a bound property is changed.
PropertyEditor Objects that implement this interface allow the designer to change and display property values.
VetoableChangeListener A method in this interface is invoked when a Constrained property is changed.
Visibility Methods in this interface allow a bean to execute in environments where the GUI is not available.

JavaBean conventions

edit

In order to function as a JavaBean class, an object class must obey certain conventions about method naming, construction, and behaviour. These conventions make it possible to have tools that can use, reuse, replace, and connect Java Beans.

The required conventions are as follows:

  • The class must have a public default constructor (with no arguments). This allows easy instantiation within editing and activation frameworks.
  • The class properties must be accessible using get, set, is (can be used for boolean properties instead of get), to and other methods (so-called accessor methods and mutator methods) according to a standard naming convention. This allows easy automated inspection and updating of bean state within frameworks, many of which include custom editors for various types of properties. Setters can have one or more arguments.
  • The class should be serializable. (This allows applications and frameworks to reliably save, store, and restore the bean's state in a manner independent of the VM and of the platform.)

Code example

edit
package player;

public class PersonBean implements java.io.Serializable {

    /** Properties **/
    private boolean deceased = false;

    private List list;

    /** Property "name", readable/writable. */
    private String name = null;

    /** No-arg constructor (takes no arguments). */
    public PersonBean() {
    }

    public List getList() {
        return list;
    }
	
    public void setList(final List list) {
        this.list = list;
    }

    /**
     * Getter for property "name".
     */
    public String getName() {
        return name;
    }

    /**
     * Setter for property "name".
     *
     * @param value
     */
    public void setName(final String value) {
        this.name = value;
    }

    /**
     * Getter for property "deceased"
     * Different syntax for a boolean field (is vs get)
     */
    public boolean isDeceased() {
        return deceased;
    }

    /**
     * Setter for property "deceased".
     * @param value
     */
    public void setDeceased(boolean value) {
        deceased = value;
    }
}

TestPersonBean.java:

import player.PersonBean;

/**
 * Class "TestPersonBean".
 */
public class TestPersonBean {
    /**
     * Tester method "main" for class "PersonBean".
     *
     * @param arguments
     */
    public static void main(final String[] arguments) {
        final PersonBean person = new PersonBean();

        person.setName("Bob");
        person.setDeceased(false);
        person.setList(new ArrayList());

        // Output: "Bob [alive]"
        System.out.print(person.getName());
        System.out.println(person.isDeceased() ? " [deceased]" : " [alive]");
    }
}
<jsp:useBean id="person" class="player.PersonBean" scope="page"/>
<jsp:setProperty name="person" property="*"/>

<html>
    <body>
        Name: <jsp:getProperty name="person" property="name"/><br/>
        Deceased? <jsp:getProperty name="person" property="deceased"/><br/>
        <br/>
        <form name="beanTest" method="POST" action="testPersonBean.jsp">
            Enter a name: <input type="text" name="name" size="50"><br/>
            Choose an option:
            <select name="deceased">
                <option value="false">Alive</option>
                <option value="true">Dead</option>
            </select>
            <input type="submit" value="Test the Bean">
        </form>
    </body>
</html>

See also

edit

References

edit
  1. ^ a b Bloch, Joshua (2008). Effective Java (Second ed.). Addison-Wesley. p. 13. ISBN 978-0-321-35668-0.
edit
左手无名指戴戒指什么意思 破绽是什么意思 什么钙片补钙效果最好 心形脸适合什么发型 食用葡萄糖是什么
硕士研究生是什么意思 林彪为什么叛变 为什么尿酸高 腰间盘突出吃什么药 免疫球蛋白适合什么人
来大姨妈吃什么水果 斤加一笔是什么字 什么是支气管扩张 佩奇是什么意思 什么食物含磷高
吃什么止血 宫颈炎是什么原因引起的 弥漫是什么意思 什么食物容易消化 覆盆子是什么
行李箱什么材质的好hcv8jop5ns6r.cn 什么样的痣需要切除hlguo.com 清纯是什么意思hcv8jop9ns1r.cn 后羿是什么生肖baiqunet.com 现在买什么股票好hcv9jop4ns7r.cn
5月19日是什么星座baiqunet.com 玻璃五行属什么hcv9jop5ns1r.cn 景字属于五行属什么hcv9jop4ns7r.cn 去越南要注意什么hcv8jop6ns2r.cn 姑姑的老公叫什么hcv8jop3ns4r.cn
身上起红疙瘩是什么原因hcv8jop3ns1r.cn 春天像什么的比喻句hcv9jop4ns3r.cn 梦见很多虫子是什么意思hcv9jop5ns4r.cn 误人子弟什么意思sanhestory.com 右边小腹疼是什么原因hcv7jop6ns8r.cn
俊俏什么意思hcv8jop5ns8r.cn 5月11号是什么星座hcv9jop0ns7r.cn 看男科挂什么门诊bjhyzcsm.com 麻醉科属于什么科室hcv7jop6ns8r.cn 吃蒜有什么好处hcv9jop0ns8r.cn
百度