Class ReferenceItem


  • public class ReferenceItem
    extends Item
    Information for a reference to a global definition. The reference may be replaced with an inlined copy of the definition during code generation.
    Author:
    Dennis M. Sosnoski
    • Field Detail

      • s_logger

        private static final Logger s_logger
        Logger for class.
      • m_definition

        private final DefinitionItem m_definition
        Referenced type structure definition.
    • Constructor Detail

      • ReferenceItem

        private ReferenceItem​(ReferenceItem original,
                              Item ref,
                              GroupItem parent)
        Copy constructor.
        Parameters:
        original -
        ref - reference (for overrides to copy; null if none)
        parent -
      • ReferenceItem

        ReferenceItem​(AnnotatedBase comp,
                      GroupItem parent,
                      DefinitionItem def)
        Internal constructor for direct reference.
        Parameters:
        comp - schema component
        parent - containing structure (null if a top-level structure)
        def - referenced definition
      • ReferenceItem

        ReferenceItem​(GroupItem group,
                      DefinitionItem def)
        Internal constructor for converting group to reference. This is used when an embedded group is converted to a separate definition, as needed for class reuse.
        Parameters:
        group -
        def -
    • Method Detail

      • getDefinition

        public DefinitionItem getDefinition()
        Get the referenced structure.
        Returns:
        reference
      • inlineReference

        public Item inlineReference()
        Inline the referenced structure. This replaces the reference with a deep copy of the definition, copying the reference name and optional/repeated information over to the definition.
        Returns:
        replacement group
      • copy

        protected Item copy​(Item ref,
                            GroupItem parent)
        Copy the item under a different parent.
        Specified by:
        copy in class Item
        Parameters:
        ref - reference (for overrides to copy; null if none)
        parent -
        Returns:
        copy
      • classifyContent

        protected void classifyContent()
        Classify the content of this item as attribute, element, and/or character data content, and as requiring content of some form if appropriate. If this is an element or attribute reference the actual referencing component is used for classification purposes, since that will determine the classification. Otherwise, the actual definition is used as the source of the information.
        Overrides:
        classifyContent in class Item
      • describe

        protected java.lang.String describe​(int depth,
                                            boolean classified)
        Build a description of the reference.
        Specified by:
        describe in class Item
        Parameters:
        depth - current nesting depth
        classified - include classification details flag
        Returns:
        description