Class UsageFinder.UsageVisitor

java.lang.Object
org.jibx.schema.SchemaVisitor
org.jibx.schema.UsageFinder.UsageVisitor
Enclosing class:
UsageFinder

private static class UsageFinder.UsageVisitor extends SchemaVisitor
Visitor to accumulate usage of definitions.
  • Field Details

    • m_tracker

      private final SchemaContextTracker m_tracker
      Tracker for schema context information.
    • m_usageMap

      private final ReferenceCountMap m_usageMap
      Usage counts found for each global definition.
    • m_nonSingletonSet

      private final Set m_nonSingletonSet
      Set of definitions referenced as non-required or repeating items.
    • m_newReferences

      private ArrayList m_newReferences
      Added references list (null if unused).
  • Constructor Details

    • UsageVisitor

      public UsageVisitor()
      Constructor.
  • Method Details

    • getListener

      public ISchemaListener getListener()
      Get the schema change listener for this visitor.
      Returns:
      listener
    • countUse

      private void countUse(Object obj)
      Convenience method for incrementing a use count. If tracking of added references is enabled this also adds the referenced object to the list if it's a first-time reference.
      Parameters:
      obj - referenced object (null if none, ignored if a schema type)
    • addNonSingleton

      private void addNonSingleton(Object obj)
      Convenience method for recording a non-singleton reference.
      Parameters:
      obj - referenced object (null if none)
    • addReferenceClosure

      public void addReferenceClosure(AnnotatedBase comp)
      Add usage counts for the reference closure of a definition. This counts all references from the definition, then all references from the definitions referenced by the original definition, and so on until no new references are found. This method may be called repeatedly, with the final results representing the closure of the union of the specified definitions (or the union of the closure, since these are the same).
      Parameters:
      comp - definition to be processed
    • setNameRegister

      public void setNameRegister(NameRegister reg)
      Set the register to be used for resolving name references.
      Parameters:
      reg -
    • getUsageMap

      public ReferenceCountMap getUsageMap()
      Get map of reference counts per component.
      Returns:
      count map
    • getNonSingletonSet

      public Set getNonSingletonSet()
      Get the set of definitions referenced as optional or repeating.
      Returns:
      set
    • reset

      public void reset()
      Clear all state information. This allows an instance to be reused.
    • exit

      public void exit(AttributeElement node)
      Description copied from class: SchemaVisitor
      Exit attribute element.
      Overrides:
      exit in class SchemaVisitor
      Parameters:
      node - element being exited
    • exit

      public void exit(AttributeGroupRefElement node)
      Description copied from class: SchemaVisitor
      Exit attributeGroup element for reference.
      Overrides:
      exit in class SchemaVisitor
      Parameters:
      node - element being exited
    • exit

      public void exit(ComplexExtensionElement node)
      Description copied from class: SchemaVisitor
      Exit extension element used for complex type.
      Overrides:
      exit in class SchemaVisitor
      Parameters:
      node - element being exited
    • exit

      public void exit(ComplexRestrictionElement node)
      Description copied from class: SchemaVisitor
      Exit restriction element used for complex type.
      Overrides:
      exit in class SchemaVisitor
      Parameters:
      node - element being exited
    • exit

      public void exit(ElementElement node)
      Description copied from class: SchemaVisitor
      Exit element element.
      Overrides:
      exit in class SchemaVisitor
      Parameters:
      node - element being exited
    • exit

      public void exit(GroupRefElement node)
      Description copied from class: SchemaVisitor
      Exit group element for reference.
      Overrides:
      exit in class SchemaVisitor
      Parameters:
      node - element being exited
    • exit

      public void exit(ListElement node)
      Description copied from class: SchemaVisitor
      Exit list element.
      Overrides:
      exit in class SchemaVisitor
      Parameters:
      node - element being exited
    • exit

      public void exit(SimpleExtensionElement node)
      Description copied from class: SchemaVisitor
      Exit extension element for simple type.
      Overrides:
      exit in class SchemaVisitor
      Parameters:
      node - element being exited
    • exit

      public void exit(SimpleRestrictionElement node)
      Description copied from class: SchemaVisitor
      Exit restriction element for simple type.
      Overrides:
      exit in class SchemaVisitor
      Parameters:
      node - element being exited
    • exit

      public void exit(UnionElement node)
      Description copied from class: SchemaVisitor
      Exit union element.
      Overrides:
      exit in class SchemaVisitor
      Parameters:
      node - element being exited