|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jibx.binding.model.DefinitionContext
public class DefinitionContext
Definition context information. This is used to track definitions of items that can be referenced by other items. The contexts are nested, so that names not found in a context may be defined by a containing context. The access methods take this into account, automatically delegating to the containing context (if defined) when a lookup fails.
Field Summary | |
---|---|
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). |
Constructor Summary | |
---|---|
protected |
DefinitionContext(DefinitionContext outer)
Constructor. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
protected DefinitionContext(DefinitionContext outer)
outer
- containing definition context (null
if
at root of tree)Method Detail |
---|
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 flag
null
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 namespace
null
if no problempublic NamespaceElement getElementNamespace(NameAttributes name, ValidationContext vctx)
name
- attribute group defining namevctx
- validation context in use
null
if none that matchespublic NamespaceElement getAttributeNamespace(NameAttributes name)
name
- attribute group defining name
null
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 converted
null
if not
foundpublic FormatElement getNamedFormat(java.lang.String name)
name
- conversion name to be found
null
if no conversion with that namepublic FormatElement getBestFormat(IClass clas)
clas
- information for target conversion class
null
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 converted
null
if not
foundpublic TemplateElementBase getNamedTemplate(java.lang.String name)
name
- conversion name to be found
null
if no
template with that namepublic boolean isCompatibleTemplateType(IClass clas)
clas
- information for target class
true
if compatible type, false
if notpublic ValidationProblem addNamedStructure(ContainerElementBase def)
def
- structure definition
null
if no problempublic ContainerElementBase getNamedStructure(java.lang.String label)
label
- structure definition label
null
if not definedpublic java.util.ArrayList getNamespaces()
null
if none)
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |