Add a simple bean factory API for read-only purpose
[smart-util.git] / smart-bean-util / src / main / java / com / smartitengineering / util / bean / BeanFactory.java
blob2ed370c25e0b3dc08e4f1f9498c464f014bdcd21
1 /*
2 * This is a utility project for wide range of applications
3 *
4 * Copyright (C) 8 Imran M Yousuf (imyousuf@smartitengineering.com)
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 10-1 USA
18 package com.smartitengineering.util.bean;
20 /**
21 * A Generic read-only bean factory, for registration and injection purpose.
22 * @author imyousuf
23 * @version 0.1.1
25 public interface BeanFactory {
27 /**
28 * Checks whether the bean is available in the factory of not.
29 * @param beanName Name of the bean to search with
30 * @return True iff there is a bean in this name
31 * @throws java.lang.IllegalArgumentException If beanName is blank
33 public boolean containsBean(String beanName)
34 throws IllegalArgumentException;
36 /**
37 * Retrieves the bean iff it exists.
38 * @param beanName Name of the bean to retrieve
39 * @return The bean with the specified name
40 * @throws java.lang.IllegalArgumentException if beanName is blank or if
41 * there exists no such bean,
42 * i.e., containsBean is false
44 public Object getBean(String beanName)
45 throws IllegalArgumentException;