|
From: Oliver H. <Oli...@ou...> - 2004-04-05 06:17:27
|
Hello,
I'm curios if anyone knows of a system that can take an interface or
abstract class and "fill-in" the missing methods/properties to create a
concrete class.=20
So given this interface:
interface BeanInterface {
/** =20
* @PropertyDescriptorAttribute(
* displayName=3D"The string property",=20
* shortDescription=3D"This is a string property")
*
*/
public String getStringProperty();
public void setStringProperty(String stringProp);
}
I could write something like this:
BeanInterface bean =3D (BeanInterface)
beanCreator.getConcreteClass(BeanInterface.class).getInstance();
This simple "bean from interface creator" concept combined with
meta-data leads to all kinds of cool possibilities. This idea started as
a system to auto create BeanInfo from meta-data but then I thought why
stop there?
I guess what I'm thinking of is an Aspect though not of the conventional
kind. It could be done in the AOP framework by introducing the
interface/abstract class to java.lang.Object and then auto creating
implementations for all the abstract methods in the
IntroductionInterceptor (or am I looking at this for the wrong
direction?).=20
I've started to write a very simple implementation of this using CGLIB
rather than the AOP framework but if someone's already doing something
along these lines I'd love to know about it.=20
Any comments/advice would be greatly appreciated.
Thanks
Oliver Hutchison
|