I've been kicking this idea around a bit and refining it - I'm yet to be
convinced that it is a bad one and would not be of some benefit
Why not make it possible to add enhancement annotations to arbitary
classes? You would then get the benefit of being able to share
component/validator definitions in arbitrary ways more easily among page
classes, and override these definitions without having to interfere with
your existing or preferred page class hierarchy
An example:
public abstract class SomeArbitraryClass //which does not implement IPage
{
@Bean(value = ValidationDelegate.class, lifecycle = Lifecycle.RENDER)
public abstract IValidationDelegate getDelegate();
@Bean(value = StringValidator.class, initializer =
"required=true,minimumLength=2")
public abstract IValidator getRequiredValidator();
etc.
}
Page class:
public abstract class MyPage
{
@AnnotationSource("mypackage.SomeArbitraryClass")
public SomeArbitraryClass getAnnotationSource
//rest of class ... including injected services, ASOs etc.
}
I'm not spotting hidden pitfalls, but it seems as if the implementation
may be not much more difficult than adding another EnhancementWorker to
handle the new annotation by instantiating the referenced class, then
delegating to the AnnotationEnhancementWorker to load the enhancements
from the specified class
Thoughts and comments would be welcome
Regards,
Phil Zoio
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]