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
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
FieldsModifier and TypeFieldDescriptionprivate static final int
Maximum number of characters of documentation text to include in description.private final boolean
Flag for a collection item.private String
Documentation extracted from schema for this data node.private String
Field name for value (null
if no field).private String
Flag-method name for value (null
if no flag-method).private String
Get-method name for value (null
if no get-method).private final boolean
Flag for an ignored item.private final Item
Associated item.private final boolean
Element or attribute name flag.private final boolean
Flag for an optional item.private final ClassHolder.ParentNode
Parent node (null
if none defined, only allowed for root node of tree).private String
Property name for value (null
if no property).private String
Selection constant name (only used with group selectors,null
if no selector for group).private String
Selection property name for 'if' method construction (only used with group selectors,null
if no selector for group).private String
Set-method name for value (null
if no set-method).private String
Test-method name for value (null
if no test-method).private String
Value type name. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
appendDocText
(StringBuffer buff) Append documentation text to description.protected void
Append selection constant text to description, if selection constant defined.abstract String
describe
(int depth) Generate the node description.Get the value type name in binding form.Get schema documentation for this node.Get field name used for value.Get flag-method name used for value.Get get-method name used for value.getItem()
Get associated item.Get parent node.Get property name for value.getQName()
Get the name associated with a node.Get the reference name associated with a node.Get the associated schema component.Get selection constant name.Get selection property name (used for 'if' method generation).Get set-method name used for value.Get test-method name used for value.getType()
Get the value type name.boolean
isAny()
Check if an xs:any value.boolean
Check if a collection value.boolean
Check if value is ignored.abstract boolean
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
Check if value is optional.boolean
Check if a reference (element or attribute) is associated with this node.void
setDocumentation
(String text) Set schema documentation for this node.void
setFieldName
(String name) Set field name used for value.void
setFlagMethodName
(String name) Set flag-method name used for value.void
setGetMethodName
(String name) Set get-method name used for value.void
setPropName
(String name) Set property name for value.void
setSelectConstName
(String name) Set selection constant name.void
setSelectPropName
(String name) Set selection property name (used for 'if' method generation).void
setSetMethodName
(String name) Set set-method name used for value.void
setTestMethodName
(String name) Set test-method name used for value.
-
Field Details
-
DESCRIPTION_DOCUMENTATION_LIMIT
private static final int DESCRIPTION_DOCUMENTATION_LIMITMaximum number of characters of documentation text to include in description.- See Also:
-
m_item
Associated item. -
m_parent
Parent node (null
if none defined, only allowed for root node of tree). -
m_named
private final boolean m_namedElement or attribute name flag. -
m_optional
private final boolean m_optionalFlag for an optional item. -
m_ignored
private final boolean m_ignoredFlag for an ignored item. -
m_collection
private final boolean m_collectionFlag for a collection item. -
m_documentation
Documentation extracted from schema for this data node. -
m_type
Value type name. -
m_selectPropName
Selection property name for 'if' method construction (only used with group selectors,null
if no selector for group). -
m_selectConstName
Selection constant name (only used with group selectors,null
if no selector for group). -
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
Field name for value (null
if no field). -
m_getMethodName
Get-method name for value (null
if no get-method). -
m_setMethodName
Set-method name for value (null
if no set-method). -
m_testMethodName
Test-method name for value (null
if no test-method). -
m_flagMethodName
Flag-method name for value (null
if no flag-method).
-
-
Constructor Details
-
DataNode
Constructor. This automatically links the newly constructed node to the parent node.- Parameters:
item
- associated itemparent
- parent node
-
-
Method Details
-
getItem
Get associated item.- Returns:
- item
-
getSchemaComponent
Get the associated schema component.- Returns:
- component
-
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
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
Get the reference name associated with a node.- Returns:
- reference name, or
null
if none
-
getDocumentation
Get schema documentation for this node.- Returns:
- documentation
-
setDocumentation
Set schema documentation for this node.- Parameters:
text
-
-
getType
Get the value type name.- Returns:
- type (
null
if no type associated with value, only on group)
-
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
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
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
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
Set selection constant name. This is only used with group selectors.- Parameters:
name
- (null
if no selector for group)
-
getPropName
Get property name for value.- Returns:
- name (
null
if none)
-
setPropName
Set property name for value.- Parameters:
name
- name (null
if none)
-
getFieldName
Get field name used for value.- Returns:
- name (
null
if no field)
-
setFieldName
Set field name used for value.- Parameters:
name
- (null
if no field)
-
getGetMethodName
Get get-method name used for value.- Returns:
- name (
null
if no get-method)
-
setGetMethodName
Set get-method name used for value.- Parameters:
name
- (null
if no get-method)
-
getSetMethodName
Get set-method name used for value.- Returns:
- name (
null
if no set-method)
-
setSetMethodName
Set set-method name used for value.- Parameters:
name
- (null
if no set-method)
-
getTestMethodName
Get test-method name used for value.- Returns:
- name (
null
if no set-method)
-
setTestMethodName
Set test-method name used for value.- Parameters:
name
- (null
if no set-method)
-
getFlagMethodName
Get flag-method name used for value.- Returns:
- name (
null
if no set-method)
-
setFlagMethodName
Set flag-method name used for value.- Parameters:
name
- (null
if no flag-method)
-
describe
Generate the node description.- Parameters:
depth
- current nesting depth- Returns:
- description
-
appendDocText
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
Append selection constant text to description, if selection constant defined.- Parameters:
buff
-
-