This content has been marked as final.
Show 3 replies
-
1. Re: How to pick up field-level annotations in annotation plu
alesj Dec 10, 2008 7:02 AM (in response to alrubinger)"alr" wrote:
what am I missing to get field-level annotations read?
You need to set the correct BeanAccessMode for your bean.
By default we don't look into fields.
Either set bean's BeanAccessMode to FIELDS or ALL. -
2. Re: How to pick up field-level annotations in annotation plu
alrubinger Dec 10, 2008 1:18 PM (in response to alrubinger)"alesj" wrote:
Either set bean's BeanAccessMode to FIELDS or ALL.
Great, thanks. ;)
A follow-up question:public class Pojo { @EJB private Object injectedEjb; public Object getInjectedMember() { return injectedEjb; } }
I must use "getInjectedMember"; using "getInjectedEjb" means the field annotation is ignored. This is expected according to docs in BeanAccessMode:STANDARD(BeanInfoCreator.STANDARD), // Getters and Setters FIELDS(BeanInfoCreator.FIELDS), // Getters/Setters and fields without getters and setters ALL(BeanInfoCreator.ALL); // As above but with non public fields included
No way to get private fields with a corresponding accessor/mutator read in? Why this design (against JavaBean conventions)?
S,
ALR -
3. Re: How to pick up field-level annotations in annotation plu
alesj Dec 11, 2008 1:10 PM (in response to alrubinger)"ALRubinger" wrote:
No way to get private fields with a corresponding accessor/mutator read in?
Perhaps we should join the metadata on field and its accessor/mutator if the BAM is FIELDS or ALL.
Or we can easily add new BAM - it just needs BeanInfoCreator.