Package org.jibx.binding.model
Class CollectionElement
java.lang.Object
org.jibx.binding.model.ElementBase
org.jibx.binding.model.NestingElementBase
org.jibx.binding.model.ContainerElementBase
org.jibx.binding.model.StructureElementBase
org.jibx.binding.model.CollectionElement
- All Implemented Interfaces:
IComponent
Model component for collection element of binding definition.
- Version:
- 1.0
- Author:
- Dennis M. Sosnoski
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate IClassItem
Add method information.private String
Add method name.private IClass
Item type information.private String
Item type name.private IClassItem
Iterator method information.private String
Iterator method name.private IClassItem
Load method information.private String
Load method name.private IClassItem
Size method information.private String
Size method name.private IClassItem
Store method information.private String
Store method name.static final StringArray
Enumeration of allowed attribute namesFields inherited from class org.jibx.binding.model.ElementBase
BINDING_ELEMENT, COLLECTION_ELEMENT, ELEMENT_NAMES, FORMAT_ELEMENT, INCLUDE_ELEMENT, INPUT_ELEMENT, MAPPING_ELEMENT, NAMESPACE_ELEMENT, OUTPUT_ELEMENT, SPLIT_ELEMENT, STRUCTURE_ELEMENT, TEMPLATE_ELEMENT, VALUE_ELEMENT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
checkCollectionChildren
(ValidationContext vctx, IClass type, ArrayList children) Check that child components are of types compatible with the collection item-type.private void
checkOrderedChildren
(ValidationContext vctx, ArrayList children) Check children of ordered collection for consistency.private void
checkUnorderedChildren
(ValidationContext vctx, ArrayList children) Check children of unordered collection for consistency.Get add method information.Get add method name.Get class passed to child components.Get item type information.Get item type name.Get iterator method information.Get iterator method name.Get load method information.Get load method name.Get size method information.Get size method name.Get store method information.Get store method name.boolean
Check for attribute definition.boolean
Check for content definition.boolean
Check for object present.private void
preSet
(IUnmarshallingContext uctx) Make sure all attributes are defined.void
prevalidate
(ValidationContext vctx) Prevalidate element information.void
setAddMethodName
(String name) Set add method name.boolean
setIdChild
(IComponent child) Set ID property.void
setItemTypeName
(String type) Set item type name.void
setIterMethodName
(String name) Set iterator method name.void
setLoadMethodName
(String name) Set load method name.void
setSizeMethodName
(String name) Set size method name.void
setStoreMethodName
(String name) Set store method name.void
validate
(ValidationContext vctx) Validate element information.Methods inherited from class org.jibx.binding.model.StructureElementBase
getDeclaredType, getField, getFieldName, getFlag, getGet, getGetName, getGetType, getName, getNamespace, getObjectType, getPrefix, getSet, getSetName, getSetType, getTest, getTestName, getType, getUri, getUsage, getUsageName, hasName, hasProperty, isFlagOnly, isImplicit, isOptional, setDeclaredType, setFieldName, setFlagName, setGetName, setName, setPrefix, setSetName, setTestName, setUri, setUsage, setUsageName
Methods inherited from class org.jibx.binding.model.ContainerElementBase
checkCompatibleChildren, classifyComponents, getAttributeComponents, getContentComponents, getCreateClass, getCreateType, getFactory, getFactoryName, getId, getLabel, getMarshaller, getMarshallerName, getPostset, getPostsetName, getPreget, getPregetName, getPreset, getPresetName, getUnmarshaller, getUnmarshallerName, getUsing, isAllowRepeats, isChoice, isClassified, isFlexible, isNillable, isOrdered, setAllowRepeats, setChoice, setComponents, setCreateType, setFactoryName, setFlexible, setIdChild, setLabel, setMarshallerName, setNillable, setOrdered, setPostsetName, setPregetName, setPresetName, setUnmarshallerName, setUsing, verifyConstruction
Methods inherited from class org.jibx.binding.model.NestingElementBase
addChild, childIterator, children, getDefaultStyle, getDefinitions, getStyle, getStyleName, setDefinitions, setStyleName
Methods inherited from class org.jibx.binding.model.ElementBase
getComment, name, setComment, toString, type, validateAttributes
-
Field Details
-
s_allowedAttributes
Enumeration of allowed attribute names -
m_loadMethodName
Load method name. -
m_sizeMethodName
Size method name. -
m_storeMethodName
Store method name. -
m_addMethodName
Add method name. -
m_iterMethodName
Iterator method name. -
m_itemTypeName
Item type name. -
m_loadMethodItem
Load method information. -
m_sizeMethodItem
Size method information. -
m_storeMethodItem
Store method information. -
m_addMethodItem
Add method information. -
m_iterMethodItem
Iterator method information. -
m_itemTypeClass
Item type information.
-
-
Constructor Details
-
CollectionElement
public CollectionElement()Default constructor.
-
-
Method Details
-
getItemTypeName
Get item type name.- Returns:
- item type name (or
null
if none)
-
setItemTypeName
Set item type name.- Parameters:
type
- item type name (ornull
if none)
-
getItemTypeClass
Get item type information. This call is only meaningful after validation.- Returns:
- item type information
-
getAddMethodName
Get add method name.- Returns:
- add method name (or
null
if none)
-
setAddMethodName
Set add method name.- Parameters:
name
- add method name (ornull
if none)
-
getAddMethodItem
Get add method information. This call is only meaningful after validation.- Returns:
- add method information (or
null
if none)
-
getIterMethodName
Get iterator method name.- Returns:
- iterator method name (or
null
if none)
-
setIterMethodName
Set iterator method name.- Parameters:
name
- iterator method name (ornull
if none)
-
getIterMethodItem
Get iterator method information. This call is only meaningful after validation.- Returns:
- iterator method information (or
null
if none)
-
getLoadMethodName
Get load method name.- Returns:
- load method name (or
null
if none)
-
setLoadMethodName
Set load method name.- Parameters:
name
- load method name (ornull
if none)
-
getLoadMethodItem
Get load method information. This call is only meaningful after validation.- Returns:
- load method information (or
null
if none)
-
getSizeMethodName
Get size method name.- Returns:
- size method name (or
null
if none)
-
setSizeMethodName
Set size method name.- Parameters:
name
- size method name (ornull
if none)
-
getSizeMethodItem
Get size method information. This call is only meaningful after validation.- Returns:
- size method information (or
null
if none)
-
getStoreMethodName
Get store method name.- Returns:
- store method name (or
null
if none)
-
setStoreMethodName
Set store method name.- Parameters:
name
- store method name (ornull
if none)
-
getStoreMethodItem
Get store method information. This call is only meaningful after validation.- Returns:
- store method information (or
null
if none)
-
setIdChild
Set ID property. This is never supported for an object coming from a collection.- Parameters:
child
- child defining the ID property- Returns:
true
if successful,false
if ID already defined
-
hasObject
public boolean hasObject()Check for object present. Alwaystrue
for collection.- Overrides:
hasObject
in classStructureElementBase
- Returns:
true
-
hasAttribute
public boolean hasAttribute()Check for attribute definition. Alwaysfalse
for collection.- Specified by:
hasAttribute
in interfaceIComponent
- Overrides:
hasAttribute
in classStructureElementBase
- Returns:
false
-
hasContent
public boolean hasContent()Check for content definition. Alwaystrue
for collection.- Specified by:
hasContent
in interfaceIComponent
- Overrides:
hasContent
in classStructureElementBase
- Returns:
true
-
getChildObjectType
Description copied from class:ContainerElementBase
Get class passed to child components. This call is only meaningful after validation.- Overrides:
getChildObjectType
in classContainerElementBase
- Returns:
- information for class linked by binding
-
preSet
Make sure all attributes are defined.- Parameters:
uctx
- unmarshalling context- Throws:
JiBXException
- on unmarshalling error
-
prevalidate
Description copied from class:ElementBase
Prevalidate element information. The prevalidation step is used to check isolated aspects of an element, such as the settings for enumerated values on the element and attributes. This empty base class implementation should be overridden by each subclass that requires prevalidation handling.- Overrides:
prevalidate
in classStructureElementBase
- Parameters:
vctx
- validation context
-
checkCollectionChildren
Check that child components are of types compatible with the collection item-type. This method may call itself recursively to process the children of child components which do not themselves set a type. The result is used for recursive checking to detect conditions where an inner structure defines a type but an outer one does not (which causes errors in the current code generation).- Parameters:
vctx
- validation contexttype
- collection item typechildren
- list of child components to be checked- Returns:
true
if only child is a <value> element with type,false
if not
-
checkUnorderedChildren
Check children of unordered collection for consistency. In an input binding each child element must define a unique qualified name. In an output binding each child element must define a unique type or supply a test method to allow checking when that element should be generated for an object.- Parameters:
vctx
- validation contextchildren
- list of child components
-
checkOrderedChildren
Check children of ordered collection for consistency. In an input binding each child element must use a different qualified name from the preceding child element. In an output binding each child element must define a different type from the preceding child element, or the preceding child element must supply a test method to allow checking when that element should be generated for an object.- Parameters:
vctx
- validation contextchildren
- list of child components
-
validate
Description copied from class:ElementBase
Validate element information. The validation step is used for checking the interactions between elements, such as name references to other elements. TheElementBase.prevalidate(org.jibx.binding.model.ValidationContext)
method will always be called for every element in the binding definition before this method is called for any element. This empty base class implementation should be overridden by each subclass that requires validation handling.- Overrides:
validate
in classStructureElementBase
- Parameters:
vctx
- validation context
-