ex7_21.txt

来自「j2ee core design patterns」· 文本 代码 · 共 29 行

TXT
29
字号
Example 7.21 Business Object: CustomerBO.java

public class CustomerBO {
    // CustomerData is a Data Object
    private CustomerData customerData;

    // ContactInfoBO is a dependent Business Object
    private ContactInfoBO contactInfoBO;

    public CustomerBO(CustomerData customerData) {
        // validate CustomerData values
        . . .
        // copy customer data to this object
        this.customerData = customerData;
    }

    public ContactInfoBO getContactInfoBO () {
        // if ContactInfoBO is not created, get data from 
        // customer data and wrap it with the 
        // ContactInfoBO wrapper
        if (contactInfoBO == null)
            contactInfoBO = new ContactInfoBO(
            customerData.getContactInfoData());
        return contactInfoBO;
    }

    // business methods for CustomerBO
    . . . 
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?