集册 Java实例教程 给定其名称,返回BeanFactory类中的bean getter的名称。

给定其名称,返回BeanFactory类中的bean getter的名称。

欢马劈雪     最近更新时间:2020-01-02 10:19:05

505
给定其名称,返回BeanFactory类中的bean getter的名称。


//package com.nowjava;/**from N  o w  J a v a . c o m**/


public class Main {



    /**

     * Returns the name of the bean getter in the BeanFactory class given its

     * name.

     * 

     * @param id

     *            Id of the bean as defined in the context file.

     * 

     * @return The name of the bean getter name in the BeanFactory class.

     */

    public static String getBeanGetterName(String id) {

        if (id == null) {

            throw new NullPointerException("Bean id cannot be null");

        }

        id = id.trim();

        if ("".equals(id)) {

            throw new IllegalArgumentException("Bean id cannot be empty");

        }

        final String id1 = id.substring(0
展开阅读全文