Package org.jibx.binding.model
Class StructureElement
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.StructureElement
- All Implemented Interfaces:
IComponent
Model component for structure element of binding definition.
- Author:
- Dennis M. Sosnoski
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate TemplateElementBaseBinding to use for this object.private booleanFlag for structure has a concrete mapping, possibly indeterminant.private StringMapping type name to use for this object.private QNameMapping qualified type name to use for this object.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 TypeMethodDescriptionprivate voidcheckNamespaceUsage(TemplateElementBase base, ValidationContext vctx) Check for conflicts on namespace prefix usage.protected voidClassify child components as contributing attributes, content, or both.Get actual type mapping.Get name of mapping type.Get qualified name of mapping type.getName()Get name.private StringJiBX access method to get mapping type name as qualified name.getType()Get value type information.getUri()Get specified namespace URI.booleanCheck if component defines one or more attribute values of the containing element.booleanCheck if component defines one or more elements or text values as children of the containing element.booleanCheck if this structure defines a name directly.booleanhasName()Check if component has a name.private voidmergeNamespaces(DefinitionContext defc, DefinitionContext addc, ValidationContext vctx) Merge namespaces from an implicit context to those defined for a reference.private voidpreSet(IUnmarshallingContext uctx) Make sure all attributes are defined.voidsetMapAsName(String name) Set name of mapping type.voidsetMapAsQName(QName name) Set qualified name of mapping type.private voidsetMappingReference(ValidationContext vctx, DefinitionContext dctx, IClass type) Validate mapping reference.private voidsetQualifiedMapAs(String text, IUnmarshallingContext ictx) JiBX access method to set mapping type name as qualified name.voidvalidate(ValidationContext vctx) Validate element information.Methods inherited from class org.jibx.binding.model.StructureElementBase
getDeclaredType, getField, getFieldName, getFlag, getGet, getGetName, getGetType, getNamespace, getObjectType, getPrefix, getSet, getSetName, getSetType, getTest, getTestName, getUsage, getUsageName, hasObject, hasProperty, isFlagOnly, isImplicit, isOptional, prevalidate, setDeclaredType, setFieldName, setFlagName, setGetName, setName, setPrefix, setSetName, setTestName, setUri, setUsage, setUsageNameMethods inherited from class org.jibx.binding.model.ContainerElementBase
checkCompatibleChildren, getAttributeComponents, getChildObjectType, 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, verifyConstructionMethods 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_mapAsName
Mapping type name to use for this object. -
m_mapAsQName
Mapping qualified type name to use for this object. -
m_hasMappingName
private boolean m_hasMappingNameFlag for structure has a concrete mapping, possibly indeterminant. -
m_effectiveMapping
Binding to use for this object.
-
-
Constructor Details
-
StructureElement
public StructureElement()Default constructor.
-
-
Method Details
-
getMapAsName
Get name of mapping type.- Returns:
- mapping type name (or
nullif none)
-
setMapAsName
Set name of mapping type. This method changes the qualified name to match the mapping type.- Parameters:
name- mapping type name (ornullif none)
-
getMapAsQName
Get qualified name of mapping type.- Returns:
- mapping qualified type name (or
nullif none)
-
setMapAsQName
Set qualified name of mapping type. This method changes the mapping name to match the qualified name.- Parameters:
name- mapping qualified type name (ornullif none)
-
getEffectiveMapping
Get actual type mapping. This call is only meaningful after validation.- Returns:
- actual type mapping (or
nullif none)
-
hasDirectName
public boolean hasDirectName()Check if this structure defines a name directly.- Returns:
trueif name defined,falseif not
-
hasName
public boolean hasName()Description copied from interface:IComponentCheck if component has a name.- Specified by:
hasNamein interfaceIComponent- Overrides:
hasNamein classStructureElementBase- Returns:
trueif component has a name,falseif not
-
getName
Description copied from class:StructureElementBaseGet name.- Specified by:
getNamein interfaceIComponent- Overrides:
getNamein classStructureElementBase- Returns:
- name text
-
getUri
Description copied from class:StructureElementBaseGet specified namespace URI.- Specified by:
getUriin interfaceIComponent- Overrides:
getUriin classStructureElementBase- Returns:
- namespace URI (
nullif not set)
-
hasAttribute
public boolean hasAttribute()Description copied from interface:IComponentCheck if component defines one or more attribute values of the containing element. This method is only valid after validation.- Specified by:
hasAttributein interfaceIComponent- Overrides:
hasAttributein classStructureElementBase- Returns:
trueif one or more attribute values defined for containing element,falseif not
-
hasContent
public boolean hasContent()Description copied from interface:IComponentCheck if component defines one or more elements or text values as children of the containing element. This method is only valid after validation.- Specified by:
hasContentin interfaceIComponent- Overrides:
hasContentin classStructureElementBase- Returns:
trueif one or more content values defined for containing element,falseif not
-
getType
Description copied from interface:IComponentGet value type information. This call is only meaningful after prevalidation.- Specified by:
getTypein interfaceIComponent- Overrides:
getTypein classStructureElementBase- Returns:
- type information
-
setQualifiedMapAs
JiBX access method to set mapping type name as qualified name.- Parameters:
text- mapping name text (nullif none)ictx- unmarshalling context- Throws:
JiBXException- on deserialization error
-
getQualifiedMapAs
JiBX access method to get mapping type name as qualified name.- Parameters:
ictx- marshalling context- Returns:
- mapping type name text (
nullif none) - Throws:
JiBXException- on deserialization error
-
preSet
Make sure all attributes are defined.- Parameters:
uctx- unmarshalling context- Throws:
JiBXException- on unmarshalling error
-
mergeNamespaces
private void mergeNamespaces(DefinitionContext defc, DefinitionContext addc, ValidationContext vctx) Merge namespaces from an implicit context to those defined for a reference.- Parameters:
defc- context supplying namespaces to be mergedaddc- context to be merged intovctx-
-
checkNamespaceUsage
Check for conflicts on namespace prefix usage. Abstract mappings may define namespaces, but the prefixes used by the abstract mappings must not conflict with those used at the point of reference. This allows the namespace definitions from the abstract mapping to be promoted to the containing element.- Parameters:
base-vctx-
-
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.- Overrides:
classifyComponentsin classContainerElementBase- Parameters:
vctx-
-
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 classStructureElementBase- Parameters:
vctx- validation context
-
setMappingReference
Validate mapping reference.- Parameters:
vctx- validation contextdctx- definition contexttype- referenced type
-