"alesj" wrote :
| You didn't "copy" ALR's code well enough. ;-)
|
| Your BeanAnnotationAdapter is not a singleton.
| See
| * BeanAnnotationAdapterFactory
| * AnnotationsAction
|
sorry, I changed it last night when I couldn't figure out what's wrong. So this is
now fixed
| BeanAnnotationAdapter beanAnnotationAdapter =
BeanAnnotationAdapterFactory.getInstance().getBeanAnnotationAdapter();
| String beanAnnotationAdapterBindName =
"MyBeanAnnotationAdapter";
| BeanMetaDataBuilder bmdb =
BeanMetaDataBuilder.createBuilder(beanAnnotationAdapterBindName,
beanAnnotationAdapter.getClass().getName());
| bmdb.addMethodInstallCallback("addAnnotationPlugin");
| bmdb.addMethodUninstallCallback("removeAnnotationPlugin");
| //bmdb.setAccessMode(BeanAccessMode.FIELDS);
| kernel.getController().install(bmdb.getBeanMetaData(),
beanAnnotationAdapter);
|
but to get FieldAnnotationPlugin to work, I had to delete/comment out setter in my class,
like:
| public class Library {
| @DoSomething
| private String name;
|
| public Library() {
| }
|
| public String getName() {
| return name;
| }
| /*
|
| public void setName(String name) {
| this.name = name;
| }
| */
| }
|
Digging down to the code, I've found couple things I don't understand:
- when 'access-mode=FIELDS' then field filter is set only to IsPublicFieldFilter,
and the 'name' wouldn't get handled
- when 'access-mode=ALL' field filter is AllFieldFilter, but then within
FieldBeanInfo.setProperties property precedes and it seems like FieldAnnotationPlugin is
not used, unless setter property is not present. What annotation plugin I have to extend?
Is this correct behaviour? And if it is, can you point me in the right direction where to
look for explanation why?
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4209728#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...