Class ClassHolder.DataNode

java.lang.Object
org.jibx.schema.codegen.ClassHolder.DataNode
Direct Known Subclasses:
ClassHolder.LeafNode, ClassHolder.ParentNode
Enclosing class:
ClassHolder

protected abstract static class ClassHolder.DataNode extends Object
Information for a data structure component of a class definition. The class data structure is defined by a tree of these components, with the interior nodes of the tree representing groupings which may need to be reflected in the actual data representation and/or the constructed binding. Because of this difference in purpose different subclasses are used for the interior nodes vs. the leaf nodes.
  • Field Details

    • DESCRIPTION_DOCUMENTATION_LIMIT

      private static final int DESCRIPTION_DOCUMENTATION_LIMIT
      Maximum number of characters of documentation text to include in description.
      See Also:
    • m_item

      private final Item m_item
      Associated item.
    • m_parent

      private final ClassHolder.ParentNode m_parent
      Parent node (null if none defined, only allowed for root node of tree).
    • m_named

      private final boolean m_named
      Element or attribute name flag.
    • m_optional

      private final boolean m_optional
      Flag for an optional item.
    • m_ignored

      private final boolean m_ignored
      Flag for an ignored item.
    • m_collection

      private final boolean m_collection
      Flag for a collection item.
    • m_documentation

      private String m_documentation
      Documentation extracted from schema for this data node.
    • m_type

      private String m_type
      Value type name.
    • m_selectPropName

      private String m_selectPropName
      Selection property name for 'if' method construction (only used with group selectors, null if no selector for group).
    • m_selectConstName

      private String m_selectConstName
      Selection constant name (only used with group selectors, null if no selector for group).
    • m_propName

      private String m_propName
      Property name for value (null if no property). Even interior nodes may have property names, in the case of a choice between different alternatives.
    • m_fieldName

      private String m_fieldName
      Field name for value (null if no field).
    • m_getMethodName

      private String m_getMethodName
      Get-method name for value (null if no get-method).
    • m_setMethodName

      private String m_setMethodName
      Set-method name for value (null if no set-method).
    • m_testMethodName

      private String m_testMethodName
      Test-method name for value (null if no test-method).
    • m_flagMethodName

      private String m_flagMethodName
      Flag-method name for value (null if no flag-method).
  • Constructor Details

    • DataNode

      public DataNode(Item item, ClassHolder.ParentNode parent)
      Constructor. This automatically links the newly constructed node to the parent node.
      Parameters:
      item - associated item
      parent - parent node
  • Method Details

    • getItem

      public Item getItem()
      Get associated item.
      Returns:
      item
    • getSchemaComponent

      public AnnotatedBase getSchemaComponent()
      Get the associated schema component.
      Returns:
      component
    • getParent

      public ClassHolder.ParentNode getParent()
      Get parent node.
      Returns:
      parent
    • isInterior

      public abstract boolean isInterior()
      Check if this is an interior node. This method is overridden by each subclass to return the appropriate result.
      Returns:
      true if node with children, false if not
    • isIgnored

      public boolean isIgnored()
      Check if value is ignored.
      Returns:
      ignored
    • isOptional

      public boolean isOptional()
      Check if value is optional.
      Returns:
      optional
    • isCollection

      public boolean isCollection()
      Check if a collection value.
      Returns:
      true if collection
    • isList

      public boolean isList()
      Check if an xs:list value.
      Returns:
      true if list
    • isAny

      public boolean isAny()
      Check if an xs:any value.
      Returns:
      true if any
    • isNamed

      public boolean isNamed()
      Check if a name (element or attribute) is associated with this node.
      Returns:
      true if named
    • getQName

      public QName getQName()
      Get the name associated with a node.
      Returns:
      name, or null if none
    • isReference

      public boolean isReference()
      Check if a reference (element or attribute) is associated with this node.
      Returns:
      true if named
    • getReferenceQName

      public QName getReferenceQName()
      Get the reference name associated with a node.
      Returns:
      reference name, or null if none
    • getDocumentation

      public String getDocumentation()
      Get schema documentation for this node.
      Returns:
      documentation
    • setDocumentation

      public void setDocumentation(String text)
      Set schema documentation for this node.
      Parameters:
      text -
    • getType

      public String getType()
      Get the value type name.
      Returns:
      type (null if no type associated with value, only on group)
    • getBindingType

      public String getBindingType()
      Get the value type name in binding form. For an object type, this differs from the standard fully-qualified name in that it uses '$' rather than '.' to delimit inner class names.
      Returns:
      binding type (null if no type associated with value, only on group)
    • getSelectPropName

      public String getSelectPropName()
      Get selection property name (used for 'if' method generation). This is only used with group selectors, and is null if the containing group does not use a selector.
      Returns:
      name (null if no selector for group)
    • setSelectPropName

      public void setSelectPropName(String name)
      Set selection property name (used for 'if' method generation). This is only used with group selectors.
      Parameters:
      name - (null if no selector for group)
    • getSelectConstName

      public String getSelectConstName()
      Get selection constant name. This is only used with group selectors, and is null if the containing group does not use a selector.
      Returns:
      name (null if no selector for group)
    • setSelectConstName

      public void setSelectConstName(String name)
      Set selection constant name. This is only used with group selectors.
      Parameters:
      name - (null if no selector for group)
    • getPropName

      public String getPropName()
      Get property name for value.
      Returns:
      name (null if none)
    • setPropName

      public void setPropName(String name)
      Set property name for value.
      Parameters:
      name - name (null if none)
    • getFieldName

      public String getFieldName()
      Get field name used for value.
      Returns:
      name (null if no field)
    • setFieldName

      public void setFieldName(String name)
      Set field name used for value.
      Parameters:
      name - (null if no field)
    • getGetMethodName

      public String getGetMethodName()
      Get get-method name used for value.
      Returns:
      name (null if no get-method)
    • setGetMethodName

      public void setGetMethodName(String name)
      Set get-method name used for value.
      Parameters:
      name - (null if no get-method)
    • getSetMethodName

      public String getSetMethodName()
      Get set-method name used for value.
      Returns:
      name (null if no set-method)
    • setSetMethodName

      public void setSetMethodName(String name)
      Set set-method name used for value.
      Parameters:
      name - (null if no set-method)
    • getTestMethodName

      public String getTestMethodName()
      Get test-method name used for value.
      Returns:
      name (null if no set-method)
    • setTestMethodName

      public void setTestMethodName(String name)
      Set test-method name used for value.
      Parameters:
      name - (null if no set-method)
    • getFlagMethodName

      public String getFlagMethodName()
      Get flag-method name used for value.
      Returns:
      name (null if no set-method)
    • setFlagMethodName

      public void setFlagMethodName(String name)
      Set flag-method name used for value.
      Parameters:
      name - (null if no flag-method)
    • describe

      public abstract String describe(int depth)
      Generate the node description.
      Parameters:
      depth - current nesting depth
      Returns:
      description
    • appendDocText

      protected void appendDocText(StringBuffer buff)
      Append documentation text to description. This appends a potentially truncated version of the documentation for the component to the description text under construction, also trimming whitespace and replacing line breaks with pipe characters to keep the description text to a single line.
      Parameters:
      buff -
    • appendSelectConstText

      protected void appendSelectConstText(StringBuffer buff)
      Append selection constant text to description, if selection constant defined.
      Parameters:
      buff -