Package org.jibx.binding.model
Class ContainerElementBase
java.lang.Object
org.jibx.binding.model.ElementBase
org.jibx.binding.model.NestingElementBase
org.jibx.binding.model.ContainerElementBase
- Direct Known Subclasses:
StructureElementBase,TemplateElementBase
Model component for elements that can contain detailed binding information in
the form of nested child components. Elements of this type include
mapping, template, structure, and collection
elements.
- Author:
- Dennis M. Sosnoski
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ArrayListChild components defining attributes (created during validation, contains subset of child components defining attributes).private ArrayListChild components defining content (created during validation, contains subset of child components defining element or character data content).private IComponentChild component that contributes an ID (nullif none).private booleanFlag for child classification in progress.private StringLabel for this structure definition.private ObjectAttributesObject attributes information for nesting.private StructureAttributesStructure attributes information for nesting.private StringLabel for structure to be used as definition.static final StringArrayEnumeration 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 TypeMethodDescriptionprotected voidcheckCompatibleChildren(ValidationContext vctx, IClass type, ArrayList children) Check that child components are of types compatible with the container object type.protected voidClassify child components as contributing attributes, content, or both.Get list of child components contributing attribute items to this container element.Get class passed to child components.Get list of child components contributing content items to this container element.Get new instance creation class information.Get type to be used for creating new instance.Get factory method information.Get factory method name.getId()Get ID property child.getLabel()Get label for this definition.Get marshaller class information.Get marshaller class name.abstract IClassGet class linked to binding element.Get post-set method information.Get post-set method name.Get pre-get method information.Get pre-get method name.Get pre-set method information.Get pre-set method name.Get unmarshaller class information.Get unmarshaller class name.getUsing()Get label for definition to be used.abstract booleanCheck if this container defines a context object.booleanCheck if repeated child elements are allowed.booleanisChoice()Check if child components are a choice.protected booleanCheck for child components classified.booleanGet flexible flag.booleanCheck if nillable object.booleanCheck if child components are ordered.voidprevalidate(ValidationContext vctx) Prevalidate element information.voidsetAllowRepeats(boolean ignore) Set repeated child elements allowed flag.voidsetChoice(boolean choice) Set child components choice flag.protected voidsetComponents(ArrayList attribs, ArrayList contents) Set child attribute and content components directly.voidsetCreateType(String name) Set new instance type class name.voidsetFactoryName(String name) Set factory method name.voidsetFlexible(boolean flexible) Set flexible flag.final voidsetIdChild(IComponent child, ValidationContext vctx) Set ID property child.voidSet label for this definition.voidsetMarshallerName(String name) Set marshaller class name.voidsetNillable(boolean nillable) Set nillable flag.voidsetOrdered(boolean ordered) Set child components ordered flag.voidsetPostsetName(String name) Set post-set method name.voidsetPregetName(String name) Set pre-get method name.voidsetPresetName(String name) Set pre-set method name.voidsetUnmarshallerName(String name) Set unmarshaller class name.voidSet label for definition to be used.voidvalidate(ValidationContext vctx) Validate element information.protected voidverifyConstruction(ValidationContext vctx, IClass type) Check that there's a way to construct an instance of an object class for input bindings.Methods inherited from class org.jibx.binding.model.NestingElementBase
addChild, childIterator, children, getDefaultStyle, getDefinitions, getStyle, getStyleName, setDefinitions, setStyleNameMethods inherited from class org.jibx.binding.model.ElementBase
getComment, name, setComment, toString, type, validateAttributes
-
Field Details
-
s_allowedAttributes
Enumeration of allowed attribute names -
m_objectAttrs
Object attributes information for nesting. -
m_structureAttrs
Structure attributes information for nesting. -
m_label
Label for this structure definition. -
m_using
Label for structure to be used as definition. -
m_idChild
Child component that contributes an ID (nullif none). -
m_inClassify
private boolean m_inClassifyFlag for child classification in progress. -
m_contentComponents
Child components defining content (created during validation, contains subset of child components defining element or character data content). -
m_attributeComponents
Child components defining attributes (created during validation, contains subset of child components defining attributes).
-
-
Constructor Details
-
ContainerElementBase
protected ContainerElementBase(int type) Constructor.- Parameters:
type- element type code
-
-
Method Details
-
getLabel
Get label for this definition.- Returns:
- label for this definition
-
setLabel
Set label for this definition.- Parameters:
label- label for this definition
-
getUsing
Get label for definition to be used.- Returns:
- label for definition to be used
-
setUsing
Set label for definition to be used.- Parameters:
label- label for definition to be used
-
getContentComponents
Get list of child components contributing content items to this container element. This call is only meaningful after validation.- Returns:
- list of child binding components defining content items
-
getAttributeComponents
Get list of child components contributing attribute items to this container element. This call is only meaningful after validation.- Returns:
- list of child binding components defining attribute items
-
hasObject
public abstract boolean hasObject()Check if this container defines a context object.- Returns:
trueif defines context object,falseif not
-
getObjectType
Get class linked to binding element. This call is only meaningful after validation.- Returns:
- information for class linked by binding
-
getChildObjectType
Get class passed to child components. This call is only meaningful after validation.- Returns:
- information for class linked by binding
-
setIdChild
Set ID property child. Used to set the ID property associated with a particular class instance. There can only be at most one child ID property for each actual object instance.- Parameters:
child- child defining the ID propertyvctx- validation context
-
getId
Get ID property child.- Returns:
- ID child
-
getFactoryName
Get factory method name.- Returns:
- fully-qualified factory class and method name (or
nullif none)
-
getFactory
Get factory method information. This call is only meaningful after a call toprevalidate(ValidationContext).- Returns:
- factory method information (or
nullif none)
-
setFactoryName
Set factory method name.- Parameters:
name- fully qualified class and method name for object factory
-
getPresetName
Get pre-set method name.- Returns:
- pre-set method name (or
nullif none)
-
getPreset
Get pre-set method information. This call is only meaningful after a call toprevalidate(ValidationContext).- Returns:
- pre-set method information (or
nullif none)
-
setPresetName
Set pre-set method name.- Parameters:
name- member method name to be called before unmarshalling
-
getPostsetName
Get post-set method name.- Returns:
- post-set method name (or
nullif none)
-
getPostset
Get post-set method information. This call is only meaningful after a call toprevalidate(ValidationContext).- Returns:
- post-set method information (or
nullif none)
-
setPostsetName
Set post-set method name.- Parameters:
name- member method name to be called after unmarshalling
-
getPregetName
Get pre-get method name.- Returns:
- pre-get method name (or
nullif none)
-
getPreget
Get pre-get method information. This call is only meaningful after a call toprevalidate(ValidationContext).- Returns:
- pre-get method information (or
nullif none)
-
setPregetName
Set pre-get method name.- Parameters:
name- member method name to be called before marshalling
-
getMarshallerName
Get marshaller class name.- Returns:
- marshaller class name (or
nullif none)
-
getMarshaller
Get marshaller class information. This call is only meaningful after a call toprevalidate(ValidationContext).- Returns:
- class information for marshaller (or
nullif none)
-
setMarshallerName
Set marshaller class name.- Parameters:
name- class name to be used for marshalling
-
getUnmarshallerName
Get unmarshaller class name.- Returns:
- unmarshaller class name (or
nullif none)
-
getUnmarshaller
Get unmarshaller class information. This call is only meaningful after a call toprevalidate(ValidationContext).- Returns:
- class information for unmarshaller (or
nullif none)
-
setUnmarshallerName
Set unmarshaller class name.- Parameters:
name- class name to be used for unmarshalling
-
isNillable
public boolean isNillable()Check if nillable object.- Returns:
- nillable flag
-
setNillable
public void setNillable(boolean nillable) Set nillable flag.- Parameters:
nillable- flag
-
getCreateType
Get type to be used for creating new instance.- Returns:
- class name for type to be created (or
nullif none)
-
getCreateClass
Get new instance creation class information. This method is only usable a call toprevalidate(ValidationContext).- Returns:
- class information for type to be created (or
nullif none)
-
setCreateType
Set new instance type class name.- Parameters:
name- class name to be used for creating new instance
-
isFlexible
public boolean isFlexible()Get flexible flag.- Returns:
- flexible flag
-
setFlexible
public void setFlexible(boolean flexible) Set flexible flag.- Parameters:
flexible-
-
isOrdered
public boolean isOrdered()Check if child components are ordered.- Returns:
trueif ordered,falseif not
-
setOrdered
public void setOrdered(boolean ordered) Set child components ordered flag.- Parameters:
ordered-trueif ordered,falseif not
-
isChoice
public boolean isChoice()Check if child components are a choice.- Returns:
trueif choice,falseif not
-
setChoice
public void setChoice(boolean choice) Set child components choice flag.- Parameters:
choice-trueif choice,falseif not
-
isAllowRepeats
public boolean isAllowRepeats()Check if repeated child elements are allowed.- Returns:
trueif repeats allowed,falseif not
-
setAllowRepeats
public void setAllowRepeats(boolean ignore) Set repeated child elements allowed flag.- Parameters:
ignore-trueif repeated child elements to be allowed,falseif not
-
verifyConstruction
Check that there's a way to construct an instance of an object class for input bindings. This can be a factory method, an unmarshaller, a no-argument constructor already defined in the class, or a modifiable class with constructor generation enabled. If a create-type is specified, this is used in place of the declared type. The call always succeeds if the binding is output-only. Note that this method should not be changed to pass the "this" object when reporting errors, because it may be called indirectly during the validation of other elements. Because of this, it needs to only use values defined afterprevalidate(ValidationContext).- Parameters:
vctx- validation contexttype- constructed object type
-
checkCompatibleChildren
Check that child components are of types compatible with the container object type. This method may call itself recursively to process the children of child components which do not themselves set a type. It's not used directly, but is here for use by subclasses.- Parameters:
vctx- validation contexttype- structure object typechildren- list of child components to be checked
-
isClassified
protected boolean isClassified()Check for child components classified. This is a convenience method for subclasses to check if classification has already been done.- Returns:
trueif classified,falseif not
-
classifyComponents
Classify child components as contributing attributes, content, or both. This method is needed to handle on-demand classification during validation. When a child component is another instance of this class, the method calls itself on the child component prior to checking the child component's contribution.- Parameters:
vctx-
-
setComponents
Set child attribute and content components directly. This is provided for use by subclasses requiring special handling, in particular the <structure> element used as a mapping reference.- Parameters:
attribs-contents-
-
prevalidate
Description copied from class:ElementBasePrevalidate 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:
prevalidatein classNestingElementBase- Parameters:
vctx- validation context
-
validate
Description copied from class:ElementBaseValidate 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:
validatein classNestingElementBase- Parameters:
vctx- validation context
-