[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Field injection

adrian@jboss.org do-not-reply at jboss.com
Thu Mar 13 11:56:11 EDT 2008


"alesj" wrote : "adrian at jboss.org" wrote : 
  |   | i.e. the property has the same name as the field and the
  |   | get/set operations work on the field joinpoints.
  |   | But only if the property has no relevant getter/setter.
  |   | 
  | How should we pass in the 'AccessType' info/param to this?
  | e.g.
  | I only allow strict property access, so I don't want the BeanInfo abstract to failover to fields on not found property.
  | 
  | And another access issue.
  | Should I allow mixing the usage of properties and fields with JBMICROCONT-220?

It's just a case of extending the BeanInfoFactory abstraction to add an enum or something
which is configured as an attribute on our BeanMetaData.


  | // Old method for backwards compatibility
  | public BeanInfo getBeanInfo(Class<?> clazz)
  | {
  |    return getBeanInfo(clazz, BeanModel.STANDARD);
  | }
  | 
  | public BeanInfo getBeanInfo(Class<?> clazz, BeanMode mode)
  | {
  |    // Cache different versions based on the enum
  | }
  | 
  | public enum BeanMode
  | {
  |    STANDARD, // Getters and Setters
  |    FIELDS, // Getters/Setters and fields without getters and setters
  |    ALL // As above but with non public fields included,
  | }
  | 

The rest is just implementation detail.

One possible implementation would be to create a lightweight "filter"
BeanInfo impl over the ALL model for the other models?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4136349#4136349

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4136349



More information about the jboss-dev-forums mailing list