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 Details

    • 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.
  • Constructor Details

    • ItemVisitor

      public ItemVisitor()
  • Method Details

    • 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 flag
      comp - 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 component
      ref - 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 simple ValueItem wrapped in a GroupItem; 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:
      visit in class SchemaVisitor
      Parameters:
      node -
      Returns:
      false to block further expansion
    • visit

      public boolean visit(AttributeElement node)
      Visit <attribute> definition.
      Overrides:
      visit in class SchemaVisitor
      Parameters:
      node -
      Returns:
      false to block further expansion
    • visit

      public boolean visit(AttributeGroupRefElement node)
      Visit <attributeGroup> reference.
      Overrides:
      visit in class SchemaVisitor
      Parameters:
      node -
      Returns:
      false to block further expansion
    • visit

      public boolean visit(CommonCompositorDefinition node)
      Visit compositor.
      Overrides:
      visit in class SchemaVisitor
      Parameters:
      node -
      Returns:
      false to 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:
      visit in class SchemaVisitor
      Parameters:
      node -
      Returns:
      true to 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:
      visit in class SchemaVisitor
      Parameters:
      node -
      Returns:
      false to end expansion
    • visit

      public boolean visit(ElementElement node)
      Visit <element> definition.
      Overrides:
      visit in class SchemaVisitor
      Parameters:
      node -
      Returns:
      false to block further expansion
    • visit

      public boolean visit(GroupRefElement node)
      Visit <group> reference.
      Overrides:
      visit in class SchemaVisitor
      Parameters:
      node -
      Returns:
      false to block further expansion
    • visit

      public boolean visit(ListElement node)
      Visit <list> element. This adds a collection value matching the type of list.
      Overrides:
      visit in class SchemaVisitor
      Parameters:
      node -
      Returns:
      false to block further expansion
    • visit

      public boolean visit(SimpleExtensionElement node)
      Visit simple type <extension> element.
      Overrides:
      visit in class SchemaVisitor
      Parameters:
      node -
      Returns:
      true to continue expansion
    • visit

      public boolean visit(SimpleRestrictionElement node)
      Visit simple type <restriction> element.
      Overrides:
      visit in class SchemaVisitor
      Parameters:
      node -
      Returns:
      false to 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:
      visit in class SchemaVisitor
      Parameters:
      node -
      Returns:
      true to 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:
      visit in class SchemaVisitor
      Parameters:
      node -
      Returns:
      true to expand any inline types