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 intMaximum number of characters of documentation text to include in description.private final booleanFlag for a collection item.private StringDocumentation extracted from schema for this data node.private StringField name for value (nullif no field).private StringFlag-method name for value (nullif no flag-method).private StringGet-method name for value (nullif no get-method).private final booleanFlag for an ignored item.private final ItemAssociated item.private final booleanElement or attribute name flag.private final booleanFlag for an optional item.private final ClassHolder.ParentNodeParent node (nullif none defined, only allowed for root node of tree).private StringProperty name for value (nullif no property).private StringSelection constant name (only used with group selectors,nullif no selector for group).private StringSelection property name for 'if' method construction (only used with group selectors,nullif no selector for group).private StringSet-method name for value (nullif no set-method).private StringTest-method name for value (nullif no test-method).private StringValue type name. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidappendDocText(StringBuffer buff) Append documentation text to description.protected voidAppend selection constant text to description, if selection constant defined.abstract Stringdescribe(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.booleanisAny()Check if an xs:any value.booleanCheck if a collection value.booleanCheck if value is ignored.abstract booleanCheck 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.booleanCheck if value is optional.booleanCheck if a reference (element or attribute) is associated with this node.voidsetDocumentation(String text) Set schema documentation for this node.voidsetFieldName(String name) Set field name used for value.voidsetFlagMethodName(String name) Set flag-method name used for value.voidsetGetMethodName(String name) Set get-method name used for value.voidsetPropName(String name) Set property name for value.voidsetSelectConstName(String name) Set selection constant name.voidsetSelectPropName(String name) Set selection property name (used for 'if' method generation).voidsetSetMethodName(String name) Set set-method name used for value.voidsetTestMethodName(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 (nullif 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,nullif no selector for group). -
m_selectConstName
Selection constant name (only used with group selectors,nullif no selector for group). -
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
Field name for value (nullif no field). -
m_getMethodName
Get-method name for value (nullif no get-method). -
m_setMethodName
Set-method name for value (nullif no set-method). -
m_testMethodName
Test-method name for value (nullif no test-method). -
m_flagMethodName
Flag-method name for value (nullif 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:
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
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
Get the reference name associated with a node.- Returns:
- reference name, or
nullif 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 (
nullif 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 (
nullif 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 isnullif the containing group does not use a selector.- Returns:
- name (
nullif no selector for group)
-
setSelectPropName
Set selection property name (used for 'if' method generation). This is only used with group selectors.- Parameters:
name- (nullif no selector for group)
-
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
Set selection constant name. This is only used with group selectors.- Parameters:
name- (nullif no selector for group)
-
getPropName
Get property name for value.- Returns:
- name (
nullif none)
-
setPropName
Set property name for value.- Parameters:
name- name (nullif none)
-
getFieldName
Get field name used for value.- Returns:
- name (
nullif no field)
-
setFieldName
Set field name used for value.- Parameters:
name- (nullif no field)
-
getGetMethodName
Get get-method name used for value.- Returns:
- name (
nullif no get-method)
-
setGetMethodName
Set get-method name used for value.- Parameters:
name- (nullif no get-method)
-
getSetMethodName
Get set-method name used for value.- Returns:
- name (
nullif no set-method)
-
setSetMethodName
Set set-method name used for value.- Parameters:
name- (nullif no set-method)
-
getTestMethodName
Get test-method name used for value.- Returns:
- name (
nullif no set-method)
-
setTestMethodName
Set test-method name used for value.- Parameters:
name- (nullif no set-method)
-
getFlagMethodName
Get flag-method name used for value.- Returns:
- name (
nullif no set-method)
-
setFlagMethodName
Set flag-method name used for value.- Parameters:
name- (nullif 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-
-