public class BaseXmlInspectorConfig extends Object implements NeedsResourceResolver
Handles specifying XML file input.
Constructor and Description |
---|
BaseXmlInspectorConfig() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object that) |
protected Document[] |
getDocuments() |
protected InputStream[] |
getInputStreams() |
protected ResourceResolver |
getResourceResolver() |
protected PropertyStyle |
getRestrictAgainstObject() |
protected PropertyStyle |
getValidateAgainstClasses() |
int |
hashCode() |
protected boolean |
isInferInheritanceHierarchy() |
protected void |
setDefaultFile(String defaultFile) |
BaseXmlInspectorConfig |
setDocuments(Document... document)
Sets the XML using a DOM Document.
|
BaseXmlInspectorConfig |
setInferInheritanceHierarchy(boolean inferInheritanceHierarchy)
Sets whether to infer the inheritance heirarchy of types in the XML by looking them up
against corresponding Java
Classes . |
BaseXmlInspectorConfig |
setInputStream(InputStream stream)
Sets the InputStream of the XML.
|
BaseXmlInspectorConfig |
setInputStreams(InputStream... streams)
Sets the InputStreams of multiple XML files.
|
void |
setResourceResolver(ResourceResolver resourceResolver)
Set the
ResourceResolver for this class. |
BaseXmlInspectorConfig |
setRestrictAgainstObject(PropertyStyle restrictAgainstObject)
Sets the property style used to restrict XML inspection against the given Object.
|
BaseXmlInspectorConfig |
setValidateAgainstClasses(PropertyStyle validateAgainstClasses)
Sets the property style used to validate whether properties defined in the XML match those
defined by the corresponding Java
Classes . |
public BaseXmlInspectorConfig setInputStreams(InputStream... streams)
This method is more advanced than setInputStream
, as it combines multiple files,
but it is slightly more cumbersome to configure in metawidget.xml
.
public BaseXmlInspectorConfig setInputStream(InputStream stream)
public void setResourceResolver(ResourceResolver resourceResolver)
NeedsResourceResolver
ResourceResolver
for this class.
Note: we tried removing this interface, and having ConfigReader
look for
xxxConfig
classes that took a ResourceResolver
parameter in their
constructor instead. This had disadvantages:
ResourceResolver
when constructing the class
programmatically. They can pass null, but this really calls for a default constructor. But if
you have a default constructor, all subclasses must implement two constructors, and many must
therefore make two calls to setDefaultFile
setResourceResolver
in interface NeedsResourceResolver
public BaseXmlInspectorConfig setDocuments(Document... document)
public BaseXmlInspectorConfig setRestrictAgainstObject(PropertyStyle restrictAgainstObject)
Inspector
s (e.g. XmlInspector
) and
Object-based Inspector
s (e.g. PropertyTypeInspector
) in the same
application (i.e. via CompositeInspector
).
You may encounter a problem whereby the Object-based Inspector
will always stop
at null
or recursive references, whereas the XML Inspector
(which
have no knowledge of Object values) will continue. This can lead to the
WidgetBuilder
s constructing a UI for a null
Object, which may upset
some WidgetProcessor
s (e.g. BeansBindingProcessor
). To resolve
this, you can set BaseXmlInspectorConfig.setRestrictAgainstObject
, whereby the
XML-based Inspector
will do a check for null
or recursive
references, and not return any XML. In addition, setting restrictAgainstObject
allows the XML Inspector
to traverse child relationships and infer their types
using the Object. This saves having to explicitly specify those relationships in the XML.
public BaseXmlInspectorConfig setInferInheritanceHierarchy(boolean inferInheritanceHierarchy)
Classes
. This saves having to explicitly specify the
inheritance heirarchy in the XML.
Note this does not infer child relationships. For that, use
setRestrictAgainstObject
(which also implies
setInferInheritanceHierarchy
).
public BaseXmlInspectorConfig setValidateAgainstClasses(PropertyStyle validateAgainstClasses)
Classes
.protected void setDefaultFile(String defaultFile)
protected InputStream[] getInputStreams()
protected ResourceResolver getResourceResolver()
protected Document[] getDocuments()
protected PropertyStyle getRestrictAgainstObject()
protected boolean isInferInheritanceHierarchy()
protected PropertyStyle getValidateAgainstClasses()
Copyright © 2015. All Rights Reserved.