org.metawidget.inspector.iface
Interface Inspector

All Superinterfaces:
Immutable
All Known Implementing Classes:
BaseObjectInspector, BaseXmlInspector, BeanValidationInspector, CommonsValidatorInspector, CompositeInspector, FacesInspector, GwtRemoteInspectorProxy, HibernateInspector, HibernateValidatorInspector, Java5Inspector, JexlInspector, JexlXmlInspector, JpaInspector, JspAnnotationInspector, MetawidgetAnnotationInspector, OvalInspector, PageflowInspector, PropertyTypeInspector, SeamInspector, SpringAnnotationInspector, StrutsAnnotationInspector, StrutsInspector, SwingAppFrameworkInspector, ValidatingCompositeInspector, XmlInspector

public interface Inspector
extends Immutable

Common interface implemented by all Inspectors. Inspectors decouple the process of generating inspection results out of back-end metadata.

Inspectors must be immutable (or, at least, appear that way to clients. They can have caches or configuration settings internally, as long as they are threadsafe).

Note to Implementors

This interface is designed to work for the majority of use cases, but not every use case. Inevitably there are tradeoffs. For example, the toInspect parameter is redundant for XML-based Inspectors (note, however, that the type parameter is not redundant for Object-based Inspectors).

In particular, this interface does not pass an M metawidget or any other kind of 'helper context' as the other interfaces do. This is because Inspectors are meant to exist independent of any particular UI framework. Indeed, they can exist on back-end tiers where no UI framework is available at all. This seems to work for most use cases encountered so far. Theoretically, though, if you find yourself needing access to a context, consider:

 

Method Summary
 java.lang.String inspect(java.lang.Object toInspect, java.lang.String type, java.lang.String... names)
          Inspect the given Object according to the given path, and return the result as a String conforming to inspection-result-1.0.xsd.
 

Method Detail

inspect

java.lang.String inspect(java.lang.Object toInspect,
                         java.lang.String type,
                         java.lang.String... names)
Inspect the given Object according to the given path, and return the result as a String conforming to inspection-result-1.0.xsd.

Note: the method returns a String, rather than a DOM, to support the use of hetergenous technologies between the Inspectors and the Metawidgets. For example, GwtMetawidget is written in JavaScript but its Inspectors are written in Java.

Parameters:
toInspect - runtime object to inspect. May be null
type - match type attribute in inspection-result.xml
names - match name attributes under type
Returns:
XML conforming to inspection-result-1.0.xsd