public class DefinitionContext
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private NamespaceElement |
m_attributeDefault
Namespace used by default at this level for attributes.
|
private NamespaceElement |
m_elementDefault
Namespace used by default at this level for elements.
|
private ClassHierarchyContext |
m_formatContext
Class hierarchy context for format definitions (lazy create).
|
private java.util.HashMap |
m_mappingMap
Map from element names to mappings defined at level (lazy create).
|
private java.util.HashMap |
m_namedStructureMap
Named binding components (lazy create).
|
private java.util.ArrayList |
m_namespaces
Namespaces defined at level (lazy create).
|
private DefinitionContext |
m_outerContext
Link to containing definition context.
|
private java.util.HashMap |
m_prefixMap
Mapping from prefix to namespace definition (lazy create).
|
private ClassHierarchyContext |
m_templateContext
Class hierarchy context for template definitions (lazy create).
|
private java.util.HashMap |
m_uriMap
Mapping from URI to namespace definition (lazy create).
|
Modifier | Constructor and Description |
---|---|
protected |
DefinitionContext(DefinitionContext outer)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addFormat(FormatElement def,
ValidationContext vctx)
Add format to set defined at this level.
|
ValidationProblem |
addImpliedNamespace(NamespaceElement def,
ElementBase ref)
Add namespace declaration to set defined at this level.
|
void |
addMappedName(NameAttributes name,
MappingElementBase def,
ValidationContext vctx)
Add mapped name to set defined at this level.
|
ValidationProblem |
addNamedStructure(ContainerElementBase def)
Add named structure to set defined in this context.
|
ValidationProblem |
addNamespace(NamespaceElement def)
Add namespace to set defined at this level.
|
void |
addTemplate(MappingElementBase def,
ValidationContext vctx)
Add template or mapping to set defined at this level.
|
private NamespaceElement |
checkDuplicatePrefix(NamespaceElement def)
Check for namespace using the same prefix.
|
NamespaceElement |
getAttributeNamespace(NameAttributes name)
Get namespace definition for attribute name.
|
FormatElement |
getBestFormat(IClass clas)
Get best format definition for class.
|
DefinitionContext |
getContaining()
Get containing context.
|
private ClassHierarchyContext |
getContainingFormatContext()
Get containing format context.
|
private ClassHierarchyContext |
getContainingTemplateContext()
Get containing template context.
|
NamespaceElement |
getElementDefaultNamespace()
Get the default namespace applied to element definitions.
|
NamespaceElement |
getElementNamespace(NameAttributes name,
ValidationContext vctx)
Get namespace definition for element name.
|
private ClassHierarchyContext |
getFormatContext()
Get current format context.
|
(package private) DefinitionContext |
getIncludeCopy()
Copy a context for use by an included binding.
|
FormatElement |
getNamedFormat(java.lang.String name)
Get named format definition.
|
ContainerElementBase |
getNamedStructure(java.lang.String label)
Get labeled structure definition within this context.
|
TemplateElementBase |
getNamedTemplate(java.lang.String name)
Get named template definition.
|
NamespaceElement |
getNamespaceForPrefix(java.lang.String prefix)
Get namespace for prefix.
|
java.util.ArrayList |
getNamespaces()
Get the namespaces defined in this context
|
FormatElement |
getSpecificFormat(java.lang.String type)
Get specific format definition for type.
|
TemplateElementBase |
getSpecificTemplate(java.lang.String type)
Get specific template definition for type.
|
private ClassHierarchyContext |
getTemplateContext()
Get current template context.
|
(package private) void |
injectNamespaces(DefinitionContext to)
Inject namespaces from this context into another context.
|
private ValidationProblem |
internalAddNamespace(NamespaceElement def,
boolean report)
Add namespace to internal tables.
|
boolean |
isCompatibleTemplateType(IClass clas)
Checks if a class is compatible with one or more templates.
|
private final DefinitionContext m_outerContext
private NamespaceElement m_attributeDefault
private NamespaceElement m_elementDefault
private java.util.ArrayList m_namespaces
private java.util.HashMap m_prefixMap
private java.util.HashMap m_uriMap
private java.util.HashMap m_mappingMap
private ClassHierarchyContext m_formatContext
private ClassHierarchyContext m_templateContext
private java.util.HashMap m_namedStructureMap
protected DefinitionContext(DefinitionContext outer)
outer
- containing definition context (null
if
at root of tree)DefinitionContext getIncludeCopy()
void injectNamespaces(DefinitionContext to)
to
- public DefinitionContext getContaining()
null
if at root of
tree)private ClassHierarchyContext getContainingFormatContext()
null
none defined)private ClassHierarchyContext getFormatContext()
null
none
defined)private ClassHierarchyContext getContainingTemplateContext()
null
none defined)private ClassHierarchyContext getTemplateContext()
null
none
defined)public NamespaceElement getElementDefaultNamespace()
null
if none)public NamespaceElement getNamespaceForPrefix(java.lang.String prefix)
prefix
- null
if noneprivate NamespaceElement checkDuplicatePrefix(NamespaceElement def)
def
- null
if noneprivate ValidationProblem internalAddNamespace(NamespaceElement def, boolean report)
def
- report
- report default conflicts as error flagnull
if no problempublic ValidationProblem addNamespace(NamespaceElement def)
def
- namespace definition element to be added (duplicates ignored)null
if no problempublic ValidationProblem addImpliedNamespace(NamespaceElement def, ElementBase ref)
def
- namespace definition to be added (duplicates ignored)ref
- binding element referencing the namespacenull
if no problempublic NamespaceElement getElementNamespace(NameAttributes name, ValidationContext vctx)
name
- attribute group defining namevctx
- validation context in usenull
if none that matchespublic NamespaceElement getAttributeNamespace(NameAttributes name)
name
- attribute group defining namenull
if none that matchespublic void addFormat(FormatElement def, ValidationContext vctx)
def
- format definition element to be addedvctx
- validation context in usepublic FormatElement getSpecificFormat(java.lang.String type)
type
- fully qualified class name to be convertednull
if not
foundpublic FormatElement getNamedFormat(java.lang.String name)
name
- conversion name to be foundnull
if no conversion with that namepublic FormatElement getBestFormat(IClass clas)
clas
- information for target conversion classnull
if no
compatible conversion definedpublic void addMappedName(NameAttributes name, MappingElementBase def, ValidationContext vctx)
name
- mapped namedef
- mapping definitionvctx
- validation contextpublic void addTemplate(MappingElementBase def, ValidationContext vctx)
def
- template definition element to be addedvctx
- validation context in usepublic TemplateElementBase getSpecificTemplate(java.lang.String type)
type
- fully qualified class name to be convertednull
if not
foundpublic TemplateElementBase getNamedTemplate(java.lang.String name)
name
- conversion name to be foundnull
if no
template with that namepublic boolean isCompatibleTemplateType(IClass clas)
clas
- information for target classtrue
if compatible type, false
if notpublic ValidationProblem addNamedStructure(ContainerElementBase def)
def
- structure definitionnull
if no problempublic ContainerElementBase getNamedStructure(java.lang.String label)
label
- structure definition labelnull
if not definedpublic java.util.ArrayList getNamespaces()
null
if none)