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.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 Summary
Fields Modifier and Type Field Description private static int
DESCRIPTION_DOCUMENTATION_LIMIT
Maximum number of characters of documentation text to include in description.private boolean
m_collection
Flag for a collection item.private java.lang.String
m_documentation
Documentation extracted from schema for this data node.private java.lang.String
m_fieldName
Field name for value (null
if no field).private java.lang.String
m_flagMethodName
Flag-method name for value (null
if no flag-method).private java.lang.String
m_getMethodName
Get-method name for value (null
if no get-method).private boolean
m_ignored
Flag for an ignored item.private Item
m_item
Associated item.private boolean
m_named
Element or attribute name flag.private boolean
m_optional
Flag for an optional item.private ClassHolder.ParentNode
m_parent
Parent node (null
if none defined, only allowed for root node of tree).private java.lang.String
m_propName
Property name for value (null
if no property).private java.lang.String
m_selectConstName
Selection constant name (only used with group selectors,null
if no selector for group).private java.lang.String
m_selectPropName
Selection property name for 'if' method construction (only used with group selectors,null
if no selector for group).private java.lang.String
m_setMethodName
Set-method name for value (null
if no set-method).private java.lang.String
m_testMethodName
Test-method name for value (null
if no test-method).private java.lang.String
m_type
Value 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 void
appendDocText(java.lang.StringBuffer buff)
Append documentation text to description.protected void
appendSelectConstText(java.lang.StringBuffer buff)
Append selection constant text to description, if selection constant defined.abstract java.lang.String
describe(int depth)
Generate the node description.java.lang.String
getBindingType()
Get the value type name in binding form.java.lang.String
getDocumentation()
Get schema documentation for this node.java.lang.String
getFieldName()
Get field name used for value.java.lang.String
getFlagMethodName()
Get flag-method name used for value.java.lang.String
getGetMethodName()
Get get-method name used for value.Item
getItem()
Get associated item.ClassHolder.ParentNode
getParent()
Get parent node.java.lang.String
getPropName()
Get property name for value.QName
getQName()
Get the name associated with a node.QName
getReferenceQName()
Get the reference name associated with a node.AnnotatedBase
getSchemaComponent()
Get the associated schema component.java.lang.String
getSelectConstName()
Get selection constant name.java.lang.String
getSelectPropName()
Get selection property name (used for 'if' method generation).java.lang.String
getSetMethodName()
Get set-method name used for value.java.lang.String
getTestMethodName()
Get test-method name used for value.java.lang.String
getType()
Get the value type name.boolean
isAny()
Check if an xs:any value.boolean
isCollection()
Check if a collection value.boolean
isIgnored()
Check if value is ignored.abstract boolean
isInterior()
Check if this is an interior node.boolean
isList()
Check if an xs:list value.boolean
isNamed()
Check if a name (element or attribute) is associated with this node.boolean
isOptional()
Check if value is optional.boolean
isReference()
Check if a reference (element or attribute) is associated with this node.void
setDocumentation(java.lang.String text)
Set schema documentation for this node.void
setFieldName(java.lang.String name)
Set field name used for value.void
setFlagMethodName(java.lang.String name)
Set flag-method name used for value.void
setGetMethodName(java.lang.String name)
Set get-method name used for value.void
setPropName(java.lang.String name)
Set property name for value.void
setSelectConstName(java.lang.String name)
Set selection constant name.void
setSelectPropName(java.lang.String name)
Set selection property name (used for 'if' method generation).void
setSetMethodName(java.lang.String name)
Set set-method name used for value.void
setTestMethodName(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 (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 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,null
if no selector for group).
-
m_selectConstName
private java.lang.String m_selectConstName
Selection constant name (only used with group selectors,null
if no selector for group).
-
m_propName
private java.lang.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 java.lang.String m_fieldName
Field name for value (null
if no field).
-
m_getMethodName
private java.lang.String m_getMethodName
Get-method name for value (null
if no get-method).
-
m_setMethodName
private java.lang.String m_setMethodName
Set-method name for value (null
if no set-method).
-
m_testMethodName
private java.lang.String m_testMethodName
Test-method name for value (null
if no test-method).
-
m_flagMethodName
private java.lang.String m_flagMethodName
Flag-method name for value (null
if 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:
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 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 (
null
if 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 (
null
if 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 isnull
if the containing group does not use a selector.- Returns:
- name (
null
if 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
- (null
if no selector for group)
-
getSelectConstName
public java.lang.String getSelectConstName()
Get selection constant name. This is only used with group selectors, and isnull
if the containing group does not use a selector.- Returns:
- name (
null
if 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
- (null
if no selector for group)
-
getPropName
public java.lang.String getPropName()
Get property name for value.- Returns:
- name (
null
if none)
-
setPropName
public void setPropName(java.lang.String name)
Set property name for value.- Parameters:
name
- name (null
if none)
-
getFieldName
public java.lang.String getFieldName()
Get field name used for value.- Returns:
- name (
null
if no field)
-
setFieldName
public void setFieldName(java.lang.String name)
Set field name used for value.- Parameters:
name
- (null
if no field)
-
getGetMethodName
public java.lang.String getGetMethodName()
Get get-method name used for value.- Returns:
- name (
null
if no get-method)
-
setGetMethodName
public void setGetMethodName(java.lang.String name)
Set get-method name used for value.- Parameters:
name
- (null
if no get-method)
-
getSetMethodName
public java.lang.String getSetMethodName()
Get set-method name used for value.- Returns:
- name (
null
if no set-method)
-
setSetMethodName
public void setSetMethodName(java.lang.String name)
Set set-method name used for value.- Parameters:
name
- (null
if no set-method)
-
getTestMethodName
public java.lang.String getTestMethodName()
Get test-method name used for value.- Returns:
- name (
null
if no set-method)
-
setTestMethodName
public void setTestMethodName(java.lang.String name)
Set test-method name used for value.- Parameters:
name
- (null
if no set-method)
-
getFlagMethodName
public java.lang.String getFlagMethodName()
Get flag-method name used for value.- Returns:
- name (
null
if no set-method)
-
setFlagMethodName
public void setFlagMethodName(java.lang.String name)
Set flag-method name used for value.- Parameters:
name
- (null
if 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
-
-
-