Package org.jibx.schema.codegen
Class ItemVisitor
- java.lang.Object
-
- org.jibx.schema.SchemaVisitor
-
- org.jibx.schema.codegen.ItemVisitor
-
public class ItemVisitor extends SchemaVisitor
Visitor to build the code generation items corresponding to a component.
-
-
Field Summary
Fields Modifier and Type Field Description private GlobalExtensionm_globalExtension information for the global definition being constructed.private GroupItemm_groupGroup currently being constructed.private intm_nestingDepthNesting depth, tracked for indenting of debug information.private static Loggers_loggerLogger for class.
-
Constructor Summary
Constructors Constructor Description ItemVisitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddReference(AnnotatedBase comp, AnnotatedBase ref)Add a reference to a global definition to the structure.private voidaddTypeRefItem(AnnotatedBase comp, CommonTypeDefinition def)Build an item from a type reference.DefinitionItembuildGlobal(AnnotatedBase comp)Build the item structure corresponding to a schema global definition component.private GroupItembuildStructure(boolean isenum, AnnotatedBase comp)Build the item structure corresponding to a particular schema component.private JavaTypegetSchemaType(CommonTypeDefinition def)Get the data type information for a built-in schema type.booleanvisit(AnyElement node)Visit <any> definition.booleanvisit(AttributeElement node)Visit <attribute> definition.booleanvisit(AttributeGroupRefElement node)Visit <attributeGroup> reference.booleanvisit(CommonCompositorDefinition node)Visit compositor.booleanvisit(ComplexExtensionElement node)Visit complex type <extension> definition.booleanvisit(ComplexRestrictionElement node)Visit complex type <restriction> definition.booleanvisit(ElementElement node)Visit <element> definition.booleanvisit(GroupRefElement node)Visit <group> reference.booleanvisit(ListElement node)Visit <list> element.booleanvisit(SimpleExtensionElement node)Visit simple type <extension> element.booleanvisit(SimpleRestrictionElement node)Visit simple type <restriction> element.booleanvisit(SimpleTypeElement node)Visit <simpleType> element.booleanvisit(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 Detail
-
s_logger
private static final Logger s_logger
Logger for class.
-
m_global
private GlobalExtension m_global
Extension information for the global definition being constructed.
-
m_group
private GroupItem m_group
Group currently being constructed.
-
m_nestingDepth
private int m_nestingDepth
Nesting depth, tracked for indenting of debug information.
-
-
Method Detail
-
buildGlobal
public DefinitionItem buildGlobal(AnnotatedBase comp)
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
private GroupItem buildStructure(boolean isenum, AnnotatedBase comp)
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
private void addReference(AnnotatedBase comp, AnnotatedBase ref)
Add a reference to a global definition to the structure.- Parameters:
comp- referencing schema componentref- referenced schema component
-
getSchemaType
private JavaType getSchemaType(CommonTypeDefinition def)
Get the data type information for a built-in schema type.- Parameters:
def- schema type definition- Returns:
- type information
-
addTypeRefItem
private void addTypeRefItem(AnnotatedBase comp, CommonTypeDefinition def)
Build an item from a type reference. For a predefined schema type this will be a simpleValueItemwrapped in aGroupItem; for a global type it will be a reference to a global definition.- Parameters:
comp-def-
-
visit
public boolean visit(AnyElement node)
Visit <any> definition.- Overrides:
visitin classSchemaVisitor- Parameters:
node-- Returns:
falseto block further expansion
-
visit
public boolean visit(AttributeElement node)
Visit <attribute> definition.- Overrides:
visitin classSchemaVisitor- Parameters:
node-- Returns:
falseto block further expansion
-
visit
public boolean visit(AttributeGroupRefElement node)
Visit <attributeGroup> reference.- Overrides:
visitin classSchemaVisitor- Parameters:
node-- Returns:
falseto block further expansion
-
visit
public boolean visit(CommonCompositorDefinition node)
Visit compositor.- Overrides:
visitin classSchemaVisitor- Parameters:
node-- Returns:
falseto block further expansion
-
visit
public boolean visit(ComplexExtensionElement node)
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:
visitin classSchemaVisitor- Parameters:
node-- Returns:
trueto continue expansion
-
visit
public boolean visit(ComplexRestrictionElement node)
Visit complex type <restriction> definition. This adds a reference item for the base type, blocking further expansion.- Overrides:
visitin classSchemaVisitor- Parameters:
node-- Returns:
falseto end expansion
-
visit
public boolean visit(ElementElement node)
Visit <element> definition.- Overrides:
visitin classSchemaVisitor- Parameters:
node-- Returns:
falseto block further expansion
-
visit
public boolean visit(GroupRefElement node)
Visit <group> reference.- Overrides:
visitin classSchemaVisitor- Parameters:
node-- Returns:
falseto block further expansion
-
visit
public boolean visit(ListElement node)
Visit <list> element. This adds a collection value matching the type of list.- Overrides:
visitin classSchemaVisitor- Parameters:
node-- Returns:
falseto block further expansion
-
visit
public boolean visit(SimpleExtensionElement node)
Visit simple type <extension> element.- Overrides:
visitin classSchemaVisitor- Parameters:
node-- Returns:
trueto continue expansion
-
visit
public boolean visit(SimpleRestrictionElement node)
Visit simple type <restriction> element.- Overrides:
visitin classSchemaVisitor- Parameters:
node-- Returns:
falseto block further expansion
-
visit
public boolean visit(SimpleTypeElement node)
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:
visitin classSchemaVisitor- Parameters:
node-- Returns:
trueto continue expansion, unless processed as group
-
visit
public boolean visit(UnionElement node)
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:
visitin classSchemaVisitor- Parameters:
node-- Returns:
trueto expand any inline types
-
-