T
- The type of the end-result payload object.static final class GenericSAXHandler.ActiveNode<T>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private Mapper<T> |
mapper
The mapper that constructs the payload object.
|
private java.lang.String |
mapperKey
The key that was used to install and find this mapper - can be a tag
name or an XML path, using
GenericSAXHandler.XMLPATH_SEPARATOR as separator
(defined as '/'). |
private java.util.Set<java.lang.String> |
missingAttrs
Mandatory attributes which are found to be missing from the XML node
handled by this mapper.
|
private java.util.Set<java.lang.String> |
missingChld
Mandatory child elements that are found to be missing from the XML
node handled by this mapper.
|
private T |
payloadObj
The payload object being constructed and populated.
|
Constructor and Description |
---|
ActiveNode(Mapper<T> m,
T t,
java.lang.String mapKey)
Builds an
ActiveNode container instance. |
Modifier and Type | Method and Description |
---|---|
private void |
checkChild(java.lang.String chld)
Checks if a child element can appear within the node processed by
the current mapper: if constraints are active (defined) and the child
is neither mandatory nor optional, a
ConfigurationException
is thrown, otherwise the constraint check state is updated
to reflect this child's existence. |
private void |
checkMissing()
Checks if any mandatory attributes and child names are missing and
throws a
ConfigurationException if it's the case. |
private void |
resetConstraintsCheckState()
During parsing, we keep track of each node's mandatory attributes and
child elements that have not yet been encountered.
|
private void |
runApplyAttributes(org.xml.sax.Attributes attrs)
Convenience method to capture the wildcard in the caller and use the
type consistently.
|
private void |
runMergeSubObj(java.lang.Object c)
Utility method to capture the wildcard in the caller and use the
type consistently.
|
private T payloadObj
private java.lang.String mapperKey
GenericSAXHandler.XMLPATH_SEPARATOR
as separator
(defined as '/'). The object produced by the mapper will be
retrieved from the global registry of objects by the same key.private java.util.Set<java.lang.String> missingAttrs
private java.util.Set<java.lang.String> missingChld
private final void runApplyAttributes(org.xml.sax.Attributes attrs) throws ConfigurationException, java.lang.IllegalStateException
attrs
- The attributes to set into the payload object.ConfigurationException
- Thrown by Mapper.applyAttributes(Attributes, Object)
.java.lang.IllegalStateException
- Thrown by Mapper.applyAttributes(Attributes, Object)
.Mapper.applyAttributes(Attributes, Object)
private final void runMergeSubObj(java.lang.Object c)
c
- The object to be merged into this node's payload object.Mapper.mergeSubObj(Object, Object)
private final void checkMissing() throws ConfigurationException
ConfigurationException
if it's the case.ConfigurationException
- If mandatory attributes/child elements are found to be
missing.private final void resetConstraintsCheckState()
private final void checkChild(java.lang.String chld) throws ConfigurationException
ConfigurationException
is thrown, otherwise the constraint check state is updated
to reflect this child's existence.chld
- The name of the XML child element that is being checked.ConfigurationException
- If the child is unexpected.