1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.jelly.tags.swing;
17
18 /***
19 * A default Factory implementation that creates new instances from a bean class
20 *
21 * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
22 * @version $Revision: 155420 $
23 */
24 public class BeanFactory implements Factory {
25
26 private Class beanClass;
27
28 public BeanFactory(Class beanClass) {
29 this.beanClass = beanClass;
30 }
31
32 /***
33 * Create a new component instance
34 */
35 public Object newInstance() throws InstantiationException {
36 try {
37 return beanClass.newInstance();
38 } catch (IllegalAccessException e) {
39 throw new InstantiationException(e.toString());
40 }
41 }
42 }