Hi Author,
I noticed metaWidget inspector interface
public interface Inspector {
String inspect( Object toInspect, String type, String... names );
}
does not have a parameter "M metawidget" like other phase.
I think sometimes customized inspector needs to access the UIMetaWidget to get some context information or parameters.
What do you think?
Heh.
Although we have InspectionResultProcessors, we still have a problem.
If I need my customized inspector to work with other inspector, I have to use compositeInspector as well.
It could be too late to process the result because the result must be combined with other inspector.
My inspector needs to access context information to generate the result.
Oh I see. In general Inspectors need to run without any UI knowledge, because they may be run on the back-end or run on several remote tiers etc.
But if you need this functionality you could try a ThreadLocal or something. JspAnnotationInspector uses this exact trick.
Does that help?
Richard.
Thanks for suggestion.
I think it's still not enough because I need to add some new properties on JSF metaWidget so that inspector can use it. I found I can create my JSF metaWidget component that extends htmlMetaWidget, and then I can override buildWidgets method to put anything in ThreadLocal.
Hi Oliver,
I've just released Metawidget v1.30, which includes an improvement you may find useful. Basically InspectionResultProcessors now get given the Object being inspected. I have used this capability myself to refactor a number of other Inspectors to avoid using ThreadLocals. See http://blog.kennardconsulting.com/2011/08/metawidget-125-to-130-migration-guide.html
You may be able to rework your own code to avoid the ThreadLocal. You can use XmlUtils.combineElements within an InspectionResultProcessor to combine the result with other inspections (this is basically all CompositeInspector does).
I'd be most grateful if you could download it and confirm it works for you.
Regards,
Richard.
< Previous |
1 |
Next >
Add a Reply
This forum does not allow anonymous participation.
Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.