Package org.jibx.schema.codegen
Class ItemVisitor
java.lang.Object
org.jibx.schema.SchemaVisitor
org.jibx.schema.codegen.ItemVisitor
Visitor to build the code generation items corresponding to a component.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate GlobalExtension
Extension information for the global definition being constructed.private GroupItem
Group currently being constructed.private int
Nesting depth, tracked for indenting of debug information.private static final Logger
Logger for class. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addReference
(AnnotatedBase comp, AnnotatedBase ref) Add a reference to a global definition to the structure.private void
addTypeRefItem
(AnnotatedBase comp, CommonTypeDefinition def) Build an item from a type reference.buildGlobal
(AnnotatedBase comp) Build the item structure corresponding to a schema global definition component.private GroupItem
buildStructure
(boolean isenum, AnnotatedBase comp) Build the item structure corresponding to a particular schema component.private JavaType
Get the data type information for a built-in schema type.boolean
visit
(AnyElement node) Visit <any> definition.boolean
visit
(AttributeElement node) Visit <attribute> definition.boolean
Visit <attributeGroup> reference.boolean
Visit compositor.boolean
visit
(ComplexExtensionElement node) Visit complex type <extension> definition.boolean
Visit complex type <restriction> definition.boolean
visit
(ElementElement node) Visit <element> definition.boolean
visit
(GroupRefElement node) Visit <group> reference.boolean
visit
(ListElement node) Visit <list> element.boolean
visit
(SimpleExtensionElement node) Visit simple type <extension> element.boolean
Visit simple type <restriction> element.boolean
visit
(SimpleTypeElement node) Visit <simpleType> element.boolean
visit
(UnionElement node) Visit <union> element.Methods inherited from class org.jibx.schema.SchemaVisitor
exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, exit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
-
Field Details
-
s_logger
private static final Logger s_loggerLogger for class. -
m_global
Extension information for the global definition being constructed. -
m_group
Group currently being constructed. -
m_nestingDepth
private int m_nestingDepthNesting depth, tracked for indenting of debug information.
-
-
Constructor Details
-
ItemVisitor
public ItemVisitor()
-
-
Method Details
-
buildGlobal
Build the item structure corresponding to a schema global definition component. This sets the structure on the global component extension before filling in the details, so that circular references won't cause a problem.- Parameters:
comp
-- Returns:
- constructed structure
-
buildStructure
Build the item structure corresponding to a particular schema component. The supplied component can be a nested type definition or a nested compositor. This method may be called recursively, so it needs to save and restore the entry state.- Parameters:
isenum
- enumeration flagcomp
- schema component (should be the simpleType component in the case of an enumeration)- Returns:
- constructed structure
-
addReference
Add a reference to a global definition to the structure.- Parameters:
comp
- referencing schema componentref
- referenced schema component
-
getSchemaType
Get the data type information for a built-in schema type.- Parameters:
def
- schema type definition- Returns:
- type information
-
addTypeRefItem
Build an item from a type reference. For a predefined schema type this will be a simpleValueItem
wrapped in aGroupItem
; for a global type it will be a reference to a global definition.- Parameters:
comp
-def
-
-
visit
Visit <any> definition.- Overrides:
visit
in classSchemaVisitor
- Parameters:
node
-- Returns:
false
to block further expansion
-
visit
Visit <attribute> definition.- Overrides:
visit
in classSchemaVisitor
- Parameters:
node
-- Returns:
false
to block further expansion
-
visit
Visit <attributeGroup> reference.- Overrides:
visit
in classSchemaVisitor
- Parameters:
node
-- Returns:
false
to block further expansion
-
visit
Visit compositor.- Overrides:
visit
in classSchemaVisitor
- Parameters:
node
-- Returns:
false
to block further expansion
-
visit
Visit complex type <extension> definition. This adds a reference item for the base type, then continues expansion to handle the items added by extension.- Overrides:
visit
in classSchemaVisitor
- Parameters:
node
-- Returns:
true
to continue expansion
-
visit
Visit complex type <restriction> definition. This adds a reference item for the base type, blocking further expansion.- Overrides:
visit
in classSchemaVisitor
- Parameters:
node
-- Returns:
false
to end expansion
-
visit
Visit <element> definition.- Overrides:
visit
in classSchemaVisitor
- Parameters:
node
-- Returns:
false
to block further expansion
-
visit
Visit <group> reference.- Overrides:
visit
in classSchemaVisitor
- Parameters:
node
-- Returns:
false
to block further expansion
-
visit
Visit <list> element. This adds a collection value matching the type of list.- Overrides:
visit
in classSchemaVisitor
- Parameters:
node
-- Returns:
false
to block further expansion
-
visit
Visit simple type <extension> element.- Overrides:
visit
in classSchemaVisitor
- Parameters:
node
-- Returns:
true
to continue expansion
-
visit
Visit simple type <restriction> element.- Overrides:
visit
in classSchemaVisitor
- Parameters:
node
-- Returns:
false
to block further expansion
-
visit
Visit <simpleType> element. This checks for the special case of a type definition which consists of an enumeration, and adds a group to represent the enumeration if found.- Overrides:
visit
in classSchemaVisitor
- Parameters:
node
-- Returns:
true
to continue expansion, unless processed as group
-
visit
Visit <union> element. This directly builds a structure matching the component types of the union, with the nested types handled directly and the referenced types added separately.- Overrides:
visit
in classSchemaVisitor
- Parameters:
node
-- Returns:
true
to expand any inline types
-