public class HibernateInspector extends BaseXmlInspector
mLog
Constructor and Description |
---|
HibernateInspector(HibernateInspectorConfig config) |
Modifier and Type | Method and Description |
---|---|
protected Element |
getDocumentElement(ResourceResolver resolver,
InputStream... files)
Overridden to automatically drill into Hibernate Configuration files.
|
protected String |
getExtendsAttribute()
Hibernate supports
extends via its <subclass> element. |
protected String |
getTopLevelTypeAttribute()
Overridden to search by
name= , not type= . |
protected String |
getTypeAttribute()
The attribute on child elements that identifies another top-level element.
|
protected Map<String,String> |
inspectProperty(Element toInspect)
Inspect the given Element and return a Map of attributes if it is a property.
|
protected void |
preprocessDocument(Document document)
Prepend 'package' attribute to class 'name' and 'extends' attributes, and to 'class'
attributes of children.
|
getDocumentElement, getNameAttribute, getReferenceAttribute, inspect, inspectAction, inspectAsDom, inspectTrait, inspectTraits, inspectTraitSiblings, traverse, traverseFromTopLevelTypeToNamedChildren
public HibernateInspector(HibernateInspectorConfig config)
protected String getTopLevelTypeAttribute()
name=
, not type=
.getTopLevelTypeAttribute
in class BaseXmlInspector
protected String getTypeAttribute()
BaseXmlInspector
This is necessary for path traversal. If an XML format does not specify a way to traverse
from a child to another top-level element, the Inspector cannot find information along paths
(eg. foo/bar/baz
). There is a way around this but, on balance, we
decided against it (see http://blog.kennardconsulting.com/2008/01/ask-your-father.html).
getTypeAttribute
in class BaseXmlInspector
protected String getExtendsAttribute()
extends
via its <subclass>
element.getExtendsAttribute
in class BaseXmlInspector
protected Element getDocumentElement(ResourceResolver resolver, InputStream... files) throws Exception
getDocumentElement
in class BaseXmlInspector
resolver
- helper in case getDocumentElement
needs to resolve references defined
in the InputStream
.Exception
protected void preprocessDocument(Document document)
preprocessDocument
in class BaseXmlInspector
document
- DOM of XML being processedprotected Map<String,String> inspectProperty(Element toInspect)
BaseXmlInspector
It is this method's responsibility to decide whether the given Element does, in fact, qualify as a 'property' - based on its own rules. Does nothing by default.
inspectProperty
in class BaseXmlInspector
toInspect
- DOM element to inspectCopyright © 2015. All Rights Reserved.