InstanceClassFactory needs to be split up
starksm64 Feb 6, 2008 9:37 PMI 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 ManagedPropertyMarshaller> 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.