[jboss-dev-forums] [Design the new POJO MicroContainer] - InstanceClassFactory needs to be split up

scott.stark@jboss.org do-not-reply at jboss.com
Wed Feb 6 21:37:02 EST 2008


I believe the InstanceClassFactory should be split up into a base ManagedPropertyMarshaller:


  | public interface ManagedPropertyMarshaller<T extends Serializable>
  | {
  |    /**
  |     * Get the value from object.
  |     *
  |     * @param beanInfo managed object's bean info
  |     * @param property managed property
  |     * @param attachment attachment
  |     * @return meta value
  |     */
  |    MetaValue getValue(BeanInfo beanInfo, ManagedProperty property, T attachment);
  | 
  |    /**
  |     * Set the value to object.
  |     *
  |     * @param beanInfo managed object's bean info
  |     * @param property managed property
  |     * @param attachment attachment
  |     * @param value meta value
  |     */
  |    void setValue(BeanInfo beanInfo, ManagedProperty property, T attachment, MetaValue value);
  | }
  | 

The InstanceClassFactory getManagedObjectClass method:

  | public interface InstanceClassFactory<T extends Serializable> extends ManagedPropertyMarshaller<T>
  | {
  |    /**
  |     * Return the Class that represents the root ManagedObject to scan
  |     * for management object related annotations.
  |     * 
  |     * @param attachment - the instance a ManagedObject is to be created for.
  |     * @return the Class that represents the root ManagedObject.
  |     * @throws ClassNotFoundException if MO class not found
  |     */
  |    Class<? extends Serializable> getManagedObjectClass(T attachment) throws ClassNotFoundException;
  | }
  | 

and a separate RuntimeComponentName:

  | public interface RuntimeComponentName<T extends Serializable>
  | {
  |    /**
  |     * Get the runtime component name.
  |     *
  |     * @param beanInfo managed object's bean info
  |     * @param property managed property
  |     * @param attachment attachment
  |     * @param value original value
  |     * @return meta value
  |     */
  |    Object getComponentName(BeanInfo beanInfo, ManagedProperty property, T attachment, MetaValue value);
  | }
  | 

The ManagementProperty could then be updated to have specific marshallers declared:

  | @Target({ElementType.METHOD})
  | @Retention(RetentionPolicy.RUNTIME)
  | public @interface ManagementProperty
  | {
  | ...
  |    /** The getValue/setValue marshaller factory */
  |    Class<? extends InstanceClassFactory> marshallerFactory() default NULL_MARSHALLER_FACTORY.class;
  | }
  | 

Right now its cumbersome to just override marshalling for a property due to the extra behaviors of the InstanceClassFactory.


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

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



More information about the jboss-dev-forums mailing list