Package org.jibx.schema
Class SchemaContextTracker
- java.lang.Object
-
- org.jibx.schema.SchemaContextTracker
-
- All Implemented Interfaces:
ISchemaListener
- Direct Known Subclasses:
ValidationContext
public class SchemaContextTracker extends java.lang.Object implements ISchemaListener
Current schema name context tracker. This tracks the current schema and the name register associated with that schema.
-
-
Field Summary
Fields Modifier and Type Field Description protected NameRegister
m_nameRegister
Schema global name register.private ObjectStack
m_schemaStack
Schema element stack.private java.util.Set
m_traversedSchemas
Set of schema elements already visited.
-
Constructor Summary
Constructors Constructor Description SchemaContextTracker()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearTraversed()
Clear the set of schemas that have been traversed.boolean
enterSchema(SchemaElement schema)
Enter schema.void
exitSchema()
Exit schema.SchemaElement
getCurrentSchema()
Get current schema element.NameRegister
getNameRegister()
Get name register.void
setNameRegister(NameRegister reg)
Set name register.
-
-
-
Field Detail
-
m_nameRegister
protected NameRegister m_nameRegister
Schema global name register.
-
m_traversedSchemas
private final java.util.Set m_traversedSchemas
Set of schema elements already visited.
-
m_schemaStack
private final ObjectStack m_schemaStack
Schema element stack. The bottom item in this will always be the root schema element being traversed, while other items represent referenced schemas. The top item will always be the current schema.
-
-
Method Detail
-
getNameRegister
public NameRegister getNameRegister()
Get name register. This requires the name register to have been set, throwing an exception if it has not.- Returns:
- name register (never
null
)
-
setNameRegister
public void setNameRegister(NameRegister reg)
Set name register. This is provided for cases where components are being processed individually, so that the user can set the appropriate register for a component directly.- Parameters:
reg
-
-
getCurrentSchema
public SchemaElement getCurrentSchema()
Get current schema element. This requires the schema to have been set, throwing an exception if it has not.- Returns:
- current schema element (never
null
)
-
clearTraversed
public void clearTraversed()
Clear the set of schemas that have been traversed. This must be called between passes on a set of schemas, so that all the schemas will again be processed in the new pass.
-
enterSchema
public boolean enterSchema(SchemaElement schema)
Description copied from interface:ISchemaListener
Enter schema. This is called before beginning the traversal of a schema, including both standalone schemas and referenced schemas.- Specified by:
enterSchema
in interfaceISchemaListener
- Returns:
true
if schema should be entered,false
if not
-
exitSchema
public void exitSchema()
Description copied from interface:ISchemaListener
Exit schema. This is called when the tranversal of a schema is completed.- Specified by:
exitSchema
in interfaceISchemaListener
-
-