public class CompositeInspector extends Object implements DomInspector<Element>
The combining algorithm works as follows. For each element:
type
attribute in both DOMs are combined
name
attribute in both DOMs are combined
This algorithm should be suitable for most use cases, but one benefit of having a separate CompositeInspector is that developers can replace it with their own version, with its own combining algorithm, if required.
Note: the name CompositeInspector refers to the Composite design pattern.
Constructor and Description |
---|
CompositeInspector(CompositeInspectorConfig config) |
Modifier and Type | Method and Description |
---|---|
protected Document |
combineInspectionResult(Document masterDocument,
Document inspectionDocument) |
String |
inspect(Object toInspect,
String type,
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.
|
String |
inspect(String master,
Object toInspect,
String type,
String... names)
If your architecture is strongly separated, some metadata may only be available in one tier
(eg.
|
Element |
inspectAsDom(Document masterDocument,
Object toInspect,
String type,
String... names)
If your architecture is strongly separated, some metadata may only be available in one tier
(eg.
|
Element |
inspectAsDom(Object toInspect,
String type,
String... names)
This method is marked
final as it delegates directly to
inspectAsDom( Document, Object, String, String... |
protected Document |
runInspector(Inspector inspector,
Object toInspect,
String type,
String... names) |
protected Document |
runInspectors(Document masterDocument,
Object toInspect,
String type,
String... names)
Run the sub-Inspectors on the given toInspect and combine the result.
|
public CompositeInspector(CompositeInspectorConfig config)
public final String inspect(Object toInspect, String type, String... names)
This method is marked final
because most Metawidget implementations will call
inspectAsDom
directly instead. So subclasses need to override
inspectAsDom
, not inspect
.
public final String inspect(String master, Object toInspect, String type, String... names)
For this, CompositeInspector
supplies this overloaded method outside the normal
Inspector
interface. It takes an additional XML string of inspection results,
and merges forthcoming inspection results with it.
This method is marked final
because most Metawidget implementations will call
inspectAsDom
directly instead. So subclasses need to override
inspectAsDom
, not inspect
.
public final Element inspectAsDom(Object toInspect, String type, String... names)
final
as it delegates directly to
inspectAsDom( Document, Object, String, String... )
. Subclasses should override
that method instead.inspectAsDom
in interface DomInspector<Element>
public Element inspectAsDom(Document masterDocument, Object toInspect, String type, String... names)
For this, CompositeInspector
supplies this overloaded method outside the normal
DomInspector
interface. It takes an additional DOM of inspection results, and
merges forthcoming inspection results with it.
protected Document runInspectors(Document masterDocument, Object toInspect, String type, String... names) throws Exception
Subclasses may override this method to, say, run some other Inspectors concurrently.
Exception
protected Document runInspector(Inspector inspector, Object toInspect, String type, String... names) throws Exception
Exception
Copyright © 2015. All Rights Reserved.