Package org.jibx.binding.def
Class NestedBase
java.lang.Object
org.jibx.binding.def.BindingBuilder.ContainerBase
org.jibx.binding.def.NestedBase
- All Implemented Interfaces:
IComponent
,IContainer
,ILinkable
- Direct Known Subclasses:
NestedCollection
,NestedStructure
public abstract class NestedBase
extends BindingBuilder.ContainerBase
implements IComponent, IContainer
Base class for structure and collection binding definitions. This handles one
or more child components, which may be ordered or unordered.
- Author:
- Dennis M. Sosnoski
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ArrayList
Included attribute definitions (lazy create, only if needed).protected ArrayList
Nested content definitions (initially used for all child components).private IContextObj
Context object for this definition.private final DefinitionContext
Definition context for container (may be same as parent).private final boolean
Flag for context defined at level.protected final boolean
Flag for flexible element handling (used by subclasses).protected final boolean
Flag for ordered child content (used by subclasses).Fields inherited from class org.jibx.binding.def.BindingBuilder.ContainerBase
m_accessLevel, m_autoLink, m_container, m_nameStyle, m_stripPrefix, m_stripSuffix, m_styleDefault
-
Constructor Summary
ConstructorsConstructorDescriptionNestedBase
(IContainer contain, IContextObj objc, boolean ord, boolean flex, boolean defc) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addComponent
(IComponent comp) Add child component to nested structure.void
Generate code to test for content present.Get the attribute children of this mapping.Get root of binding definition.Get the content children of this mapping.Get definition context for binding element.getType()
Get type expected by component.Get element wrapper name.boolean
Check if component defines one or more elements or text values as children of the containing element.boolean
boolean
Check if content children are ordered.boolean
Check if flexible unmarshalling.boolean
Check if component is an optional item.void
setObjectContext
(IContextObj objc) Set the object context.Methods inherited from class org.jibx.binding.def.BindingBuilder.ContainerBase
getStyleDefault, unmarshal
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jibx.binding.def.IComponent
genAttributeMarshal, genAttributeUnmarshal, genAttrPresentTest, genContentMarshal, genContentUnmarshal, genLoadId, genNewInstance, hasAttribute, hasId, print
Methods inherited from interface org.jibx.binding.def.IContainer
getStyleDefault
Methods inherited from interface org.jibx.binding.def.ILinkable
setLinkages
-
Field Details
-
m_contextObject
Context object for this definition. -
m_hasContext
private final boolean m_hasContextFlag for context defined at level. -
m_isOrdered
protected final boolean m_isOrderedFlag for ordered child content (used by subclasses). -
m_isFlexible
protected final boolean m_isFlexibleFlag for flexible element handling (used by subclasses). -
m_defContext
Definition context for container (may be same as parent). -
m_attributes
Included attribute definitions (lazy create, only if needed). -
m_contents
Nested content definitions (initially used for all child components).
-
-
Constructor Details
-
NestedBase
Constructor.- Parameters:
contain
- containing binding definition contextobjc
- current object contextord
- ordered content flagflex
- flexible element handling flagdefc
- define context for structure flag
-
-
Method Details
-
setObjectContext
Set the object context.- Parameters:
objc
- object context
-
getAttributes
Get the attribute children of this mapping.- Returns:
- list of attribute children (
null
if none; should not be modified)
-
getContents
Get the content children of this mapping.- Returns:
- list of content children (should not be modified)
-
addComponent
Add child component to nested structure. All components are initially assumed to contain content. WhenILinkable.setLinkages()
is called the components are checked to determine whether they actually supply attribute(s), content, or both.- Parameters:
comp
- child component to be added to structure
-
isFlexible
public boolean isFlexible()Check if flexible unmarshalling.- Returns:
- flexible flag
-
isContentOrdered
public boolean isContentOrdered()Description copied from interface:IContainer
Check if content children are ordered.- Specified by:
isContentOrdered
in interfaceIContainer
- Returns:
true
if ordered,false
if not
-
hasNamespaces
public boolean hasNamespaces() -
getBindingRoot
Description copied from interface:IContainer
Get root of binding definition.- Specified by:
getBindingRoot
in interfaceIContainer
- Returns:
- binding definition root
-
getDefinitionContext
Description copied from interface:IContainer
Get definition context for binding element.- Specified by:
getDefinitionContext
in interfaceIContainer
- Returns:
- binding definition context
-
isOptional
public boolean isOptional()Description copied from interface:IComponent
Check if component is an optional item.- Specified by:
isOptional
in interfaceIComponent
- Returns:
true
if optional,false
if required
-
hasContent
public boolean hasContent()Description copied from interface:IComponent
Check if component defines one or more elements or text values as children of the containing element. This method is only valid after the call toILinkable.setLinkages()
.- Specified by:
hasContent
in interfaceIComponent
- Returns:
true
if one or more content values defined for containing element,false
if not
-
genContentPresentTest
Description copied from interface:IComponent
Generate code to test for content present. This generates code that tests if a required element is present, leaving the result of the test (zero if missing, nonzero if present) on the stack. This call is only valid if this component has one or more content components for the containing element.- Specified by:
genContentPresentTest
in interfaceIComponent
- Parameters:
mb
- method builder- Throws:
JiBXException
- if configuration error
-
getType
Description copied from interface:IComponent
Get type expected by component.- Specified by:
getType
in interfaceIComponent
- Returns:
- fully qualified class name of expected type
-
getWrapperName
Description copied from interface:IComponent
Get element wrapper name. If the component defines an element as the container for content, this returns the name information for that element.- Specified by:
getWrapperName
in interfaceIComponent
- Returns:
- component element name,
null
if no wrapper element
-