final Type targetBeanType = bean.getType();
final String id = bean.getId();
// sub class the target...
final NewConcreteType beanFactory = this.getBeanFactory();
final NewNestedType proxy = beanFactory.newNestedType();
proxy.setStatic(false);
proxy.setNestedName(this.escapeBeanIdToBeClassNameSafe(id) + Constants.PROXY_SUFFIX);
if (bean instanceof Rpc) {
proxy.addInterface(targetBeanType);
} else {
proxy.setSuperType(targetBeanType);
}
proxy.setVisibility(Visibility.PRIVATE);
// add a no arguments constructor...
final NewConstructor constructor = proxy.newConstructor();
constructor.setBody(EmptyCodeBlock.INSTANCE);
constructor.setVisibility(Visibility.PUBLIC);
// add a field of type target bean this will be set by the
// ProxyFactoryBean.createProxy0 method.
final NewField field = proxy.newField();
field.setFinal(false);
field.setName(Constants.PROXY_TARGET_FIELD);
field.setStatic(false);
field.setTransient(false);
field.setType(targetBeanType);