|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.implessbean.BeanFactory
Factory class to create a JavaBeans proxy that converts setter/getter access
to it to get/set method invocation of a Map specified.
This class creates a proxy instance that behave as an instance of a class
which implements specified interfaces. Invocations of the accessor method of the
proxy instance result in get()/set() method invocations of a Map
instance. So you don't have to implement accessor method, just define an interface.
If you have:
public interface Customer {
String getName();
void setName(String name);
int getId();
void setId(int id);
}
Then you can write as:
Customer customer = (Customer) BeanFactory.newBeanInstance(Customer.class);
customer.setId(10);
customer.setName("Kohji Nakamura");
int id = customer.getId();
String name = customer.getName();
This factory provides some factory methods to create a proxy instance and you can use any of them.
| Field Summary | |
static KeyMapper |
CAPITAL_STRING_MAPPER
|
static KeyMapper |
STRING_MAPPER
|
| Constructor Summary | |
BeanFactory()
|
|
| Method Summary | |
static java.lang.Object |
newBeanInstance(java.lang.Class ifClass)
Returns a proxy instance that implements the interface specified by ifClass. |
static java.lang.Object |
newBeanInstance(java.lang.Class[] ifClasses,
KeyMapper keyMapper,
java.util.Map values)
Returns a proxy instance that implements the interfaces specified by ifClasses. |
static java.lang.Object |
newBeanInstance(java.lang.Class ifClass,
KeyMapper keyMapper)
Returns a proxy instance that implements the interface specified by ifClass. |
static java.lang.Object |
newBeanInstance(java.lang.Class ifClass,
KeyMapper keyMapper,
java.util.Map values)
Returns a proxy instance that implements the interface specified by ifClass. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final KeyMapper STRING_MAPPER
StringKeyMapperpublic static final KeyMapper CAPITAL_STRING_MAPPER
CapitalStringKeyMapper| Constructor Detail |
public BeanFactory()
| Method Detail |
public static java.lang.Object newBeanInstance(java.lang.Class ifClass)
STRING_MAPPER is used as a default key mapper.
ifClass - A class object of an interface or a class.
IBaseBeanIBaseBean
public static java.lang.Object newBeanInstance(java.lang.Class ifClass,
KeyMapper keyMapper)
ifClass - A class object of an interface or a class.keyMapper - a KeyMapper object. See KeyMapper.
IBaseBeanIBaseBean
public static java.lang.Object newBeanInstance(java.lang.Class ifClass,
KeyMapper keyMapper,
java.util.Map values)
Object.equals(Object obj) method invocations
are delegated to the `values' object.
ifClass - A class object of an interface or a class.keyMapper - a KeyMapper object. See KeyMapper.values - A value container for the proxy instance returned by this method.
Changing `values' affects the proxy, vice versa,
even after the proxy creation
because the `values' parameter would not be copied.
IBaseBeanIBaseBean
public static java.lang.Object newBeanInstance(java.lang.Class[] ifClasses,
KeyMapper keyMapper,
java.util.Map values)
Object.equals(Object obj) method invocations
are delegated to the `values' object.
ifClasses - Class objects of interfaces or a classes.keyMapper - a KeyMapper object. See KeyMapper.values - A value container for the proxy instance returned by this method.
Changing `values' affects the proxy, vice versa,
even after the proxy creation
because the `values' parameter would not be copied.
IBaseBeanIBaseBean
|
Copyright (C) 2004 Kohji Nakamura. All rights reserved. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||