Package org.jibx.schema.codegen
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 java.lang.ObjectInformation 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 Summary
Fields Modifier and Type Field Description private static intDESCRIPTION_DOCUMENTATION_LIMITMaximum number of characters of documentation text to include in description.private booleanm_collectionFlag for a collection item.private java.lang.Stringm_documentationDocumentation extracted from schema for this data node.private java.lang.Stringm_fieldNameField name for value (nullif no field).private java.lang.Stringm_flagMethodNameFlag-method name for value (nullif no flag-method).private java.lang.Stringm_getMethodNameGet-method name for value (nullif no get-method).private booleanm_ignoredFlag for an ignored item.private Itemm_itemAssociated item.private booleanm_namedElement or attribute name flag.private booleanm_optionalFlag for an optional item.private ClassHolder.ParentNodem_parentParent node (nullif none defined, only allowed for root node of tree).private java.lang.Stringm_propNameProperty name for value (nullif no property).private java.lang.Stringm_selectConstNameSelection constant name (only used with group selectors,nullif no selector for group).private java.lang.Stringm_selectPropNameSelection property name for 'if' method construction (only used with group selectors,nullif no selector for group).private java.lang.Stringm_setMethodNameSet-method name for value (nullif no set-method).private java.lang.Stringm_testMethodNameTest-method name for value (nullif no test-method).private java.lang.Stringm_typeValue type name.
-
Constructor Summary
Constructors Constructor Description DataNode(Item item, ClassHolder.ParentNode parent)Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidappendDocText(java.lang.StringBuffer buff)Append documentation text to description.protected voidappendSelectConstText(java.lang.StringBuffer buff)Append selection constant text to description, if selection constant defined.abstract java.lang.Stringdescribe(int depth)Generate the node description.java.lang.StringgetBindingType()Get the value type name in binding form.java.lang.StringgetDocumentation()Get schema documentation for this node.java.lang.StringgetFieldName()Get field name used for value.java.lang.StringgetFlagMethodName()Get flag-method name used for value.java.lang.StringgetGetMethodName()Get get-method name used for value.ItemgetItem()Get associated item.ClassHolder.ParentNodegetParent()Get parent node.java.lang.StringgetPropName()Get property name for value.QNamegetQName()Get the name associated with a node.QNamegetReferenceQName()Get the reference name associated with a node.AnnotatedBasegetSchemaComponent()Get the associated schema component.java.lang.StringgetSelectConstName()Get selection constant name.java.lang.StringgetSelectPropName()Get selection property name (used for 'if' method generation).java.lang.StringgetSetMethodName()Get set-method name used for value.java.lang.StringgetTestMethodName()Get test-method name used for value.java.lang.StringgetType()Get the value type name.booleanisAny()Check if an xs:any value.booleanisCollection()Check if a collection value.booleanisIgnored()Check if value is ignored.abstract booleanisInterior()Check if this is an interior node.booleanisList()Check if an xs:list value.booleanisNamed()Check if a name (element or attribute) is associated with this node.booleanisOptional()Check if value is optional.booleanisReference()Check if a reference (element or attribute) is associated with this node.voidsetDocumentation(java.lang.String text)Set schema documentation for this node.voidsetFieldName(java.lang.String name)Set field name used for value.voidsetFlagMethodName(java.lang.String name)Set flag-method name used for value.voidsetGetMethodName(java.lang.String name)Set get-method name used for value.voidsetPropName(java.lang.String name)Set property name for value.voidsetSelectConstName(java.lang.String name)Set selection constant name.voidsetSelectPropName(java.lang.String name)Set selection property name (used for 'if' method generation).voidsetSetMethodName(java.lang.String name)Set set-method name used for value.voidsetTestMethodName(java.lang.String name)Set test-method name used for value.
-
-
-
Field Detail
-
DESCRIPTION_DOCUMENTATION_LIMIT
private static final int DESCRIPTION_DOCUMENTATION_LIMIT
Maximum number of characters of documentation text to include in description.- See Also:
- Constant Field Values
-
m_item
private final Item m_item
Associated item.
-
m_parent
private final ClassHolder.ParentNode m_parent
Parent node (nullif 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 java.lang.String m_documentation
Documentation extracted from schema for this data node.
-
m_type
private java.lang.String m_type
Value type name.
-
m_selectPropName
private java.lang.String m_selectPropName
Selection property name for 'if' method construction (only used with group selectors,nullif no selector for group).
-
m_selectConstName
private java.lang.String m_selectConstName
Selection constant name (only used with group selectors,nullif no selector for group).
-
m_propName
private java.lang.String m_propName
Property name for value (nullif no property). Even interior nodes may have property names, in the case of a choice between different alternatives.
-
m_fieldName
private java.lang.String m_fieldName
Field name for value (nullif no field).
-
m_getMethodName
private java.lang.String m_getMethodName
Get-method name for value (nullif no get-method).
-
m_setMethodName
private java.lang.String m_setMethodName
Set-method name for value (nullif no set-method).
-
m_testMethodName
private java.lang.String m_testMethodName
Test-method name for value (nullif no test-method).
-
m_flagMethodName
private java.lang.String m_flagMethodName
Flag-method name for value (nullif no flag-method).
-
-
Constructor Detail
-
DataNode
public DataNode(Item item, ClassHolder.ParentNode parent)
Constructor. This automatically links the newly constructed node to the parent node.- Parameters:
item- associated itemparent- parent node
-
-
Method Detail
-
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:
trueif node with children,falseif 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:
trueif collection
-
isList
public boolean isList()
Check if an xs:list value.- Returns:
trueif list
-
isAny
public boolean isAny()
Check if an xs:any value.- Returns:
trueif any
-
isNamed
public boolean isNamed()
Check if a name (element or attribute) is associated with this node.- Returns:
trueif named
-
getQName
public QName getQName()
Get the name associated with a node.- Returns:
- name, or
nullif none
-
isReference
public boolean isReference()
Check if a reference (element or attribute) is associated with this node.- Returns:
trueif named
-
getReferenceQName
public QName getReferenceQName()
Get the reference name associated with a node.- Returns:
- reference name, or
nullif none
-
getDocumentation
public java.lang.String getDocumentation()
Get schema documentation for this node.- Returns:
- documentation
-
setDocumentation
public void setDocumentation(java.lang.String text)
Set schema documentation for this node.- Parameters:
text-
-
getType
public java.lang.String getType()
Get the value type name.- Returns:
- type (
nullif no type associated with value, only on group)
-
getBindingType
public java.lang.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 (
nullif no type associated with value, only on group)
-
getSelectPropName
public java.lang.String getSelectPropName()
Get selection property name (used for 'if' method generation). This is only used with group selectors, and isnullif the containing group does not use a selector.- Returns:
- name (
nullif no selector for group)
-
setSelectPropName
public void setSelectPropName(java.lang.String name)
Set selection property name (used for 'if' method generation). This is only used with group selectors.- Parameters:
name- (nullif no selector for group)
-
getSelectConstName
public java.lang.String getSelectConstName()
Get selection constant name. This is only used with group selectors, and isnullif the containing group does not use a selector.- Returns:
- name (
nullif no selector for group)
-
setSelectConstName
public void setSelectConstName(java.lang.String name)
Set selection constant name. This is only used with group selectors.- Parameters:
name- (nullif no selector for group)
-
getPropName
public java.lang.String getPropName()
Get property name for value.- Returns:
- name (
nullif none)
-
setPropName
public void setPropName(java.lang.String name)
Set property name for value.- Parameters:
name- name (nullif none)
-
getFieldName
public java.lang.String getFieldName()
Get field name used for value.- Returns:
- name (
nullif no field)
-
setFieldName
public void setFieldName(java.lang.String name)
Set field name used for value.- Parameters:
name- (nullif no field)
-
getGetMethodName
public java.lang.String getGetMethodName()
Get get-method name used for value.- Returns:
- name (
nullif no get-method)
-
setGetMethodName
public void setGetMethodName(java.lang.String name)
Set get-method name used for value.- Parameters:
name- (nullif no get-method)
-
getSetMethodName
public java.lang.String getSetMethodName()
Get set-method name used for value.- Returns:
- name (
nullif no set-method)
-
setSetMethodName
public void setSetMethodName(java.lang.String name)
Set set-method name used for value.- Parameters:
name- (nullif no set-method)
-
getTestMethodName
public java.lang.String getTestMethodName()
Get test-method name used for value.- Returns:
- name (
nullif no set-method)
-
setTestMethodName
public void setTestMethodName(java.lang.String name)
Set test-method name used for value.- Parameters:
name- (nullif no set-method)
-
getFlagMethodName
public java.lang.String getFlagMethodName()
Get flag-method name used for value.- Returns:
- name (
nullif no set-method)
-
setFlagMethodName
public void setFlagMethodName(java.lang.String name)
Set flag-method name used for value.- Parameters:
name- (nullif no flag-method)
-
describe
public abstract java.lang.String describe(int depth)
Generate the node description.- Parameters:
depth- current nesting depth- Returns:
- description
-
appendDocText
protected void appendDocText(java.lang.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(java.lang.StringBuffer buff)
Append selection constant text to description, if selection constant defined.- Parameters:
buff-
-
-