Package org.jibx.schema.elements
Class ElementElement
- java.lang.Object
-
- org.jibx.schema.elements.SchemaBase
-
- org.jibx.schema.elements.OpenAttrBase
-
- org.jibx.schema.elements.AnnotatedBase
-
- org.jibx.schema.elements.ElementElement
-
- All Implemented Interfaces:
IArity
,IComponent
,INamed
,IReference
public class ElementElement extends AnnotatedBase implements IArity, INamed, IReference
<element> element definition. The same code is used for both global and local element definitions, with the differences checked during validation. TODO: implement common base class for attribute and element?- Author:
- Dennis M. Sosnoski
-
-
Field Summary
Fields Modifier and Type Field Description static int
EXTENSION_BLOCK
static int
EXTENSION_FINAL
private long
IDENTITY_CONSTRAINT_MASK
Mask bits for identity constraint children.private long
INLINE_TYPE_MASK
Mask bits for inline type definition child.private boolean
m_abstract
'abstract' attribute value.private AllEnumSet
m_block
'block' attribute value.private java.lang.String
m_default
'default' attribute value.private DefRefAttributeGroup
m_defRef
Name or reference.private AllEnumSet
m_final
'final' attribute value.private java.lang.String
m_fixed
'fixed' attribute value.private FormChoiceAttribute
m_formChoice
Form of name.private FilteredSegmentList
m_identityConstraintList
Filtered list of identity constraint elements (zero or more).private FilteredSegmentList
m_inlineTypeList
Filtered list of inline type definition elements (zero or one only).private boolean
m_nillable
'nillable' attribute value.private OccursAttributeGroup
m_occurs
Occurs attribute group.private QName
m_qname
Qualified name (only defined after validation).private ElementElement
m_refElement
Element definition (from 'ref' attribute -null
if none).private QName
m_substitutionGroup
'substitutionGroup' attribute information.private QName
m_type
'type' attribute value.private CommonTypeDefinition
m_typeDefinition
Complex or simple type definition (from 'type' attribute, or inline definition -null
if none).static int
RESTRICTION_BLOCK
static int
RESTRICTION_FINAL
static StringArray
s_allowedAttributes
List of allowed attribute names.static EnumSet
s_blockValues
static EnumSet
s_derivationValues
static int
SUBSTITUTION_BLOCK
-
Fields inherited from class org.jibx.schema.elements.SchemaBase
ALL_TYPE, ANNOTATION_TYPE, ANY_TYPE, ANYATTRIBUTE_TYPE, APPINFO_TYPE, ATTRIBUTE_TYPE, ATTRIBUTEGROUP_TYPE, CHOICE_TYPE, COMPLEXCONTENT_TYPE, COMPLEXTYPE_TYPE, DOCUMENTATION_TYPE, ELEMENT_MASKS, ELEMENT_NAMES, ELEMENT_TYPE, ENUMERATION_TYPE, EXTENSION_TYPE, FIELD_TYPE, FRACTIONDIGITS_TYPE, GROUP_TYPE, IMPORT_TYPE, INCLUDE_TYPE, KEY_TYPE, KEYREF_TYPE, LENGTH_TYPE, LIST_TYPE, MAXEXCLUSIVE_TYPE, MAXINCLUSIVE_TYPE, MAXLENGTH_TYPE, MINEXCLUSIVE_TYPE, MININCLUSIVE_TYPE, MINLENGTH_TYPE, NOTATION_TYPE, PATTERN_TYPE, REDEFINE_TYPE, RESTRICTION_TYPE, SCHEMA_TYPE, SELECTOR_TYPE, SEQUENCE_TYPE, SIMPLECONTENT_TYPE, SIMPLETYPE_TYPE, TOTALDIGITS_TYPE, UNION_TYPE, UNIQUE_TYPE, WHITESPACE_TYPE
-
Fields inherited from interface org.jibx.schema.IComponent
SCHEMA_NAMESPACE
-
-
Constructor Summary
Constructors Constructor Description ElementElement()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
clearType()
Clear any type information.AllEnumSet
getBlock()
Get 'block' attribute.java.lang.String
getDefault()
Get 'default' attribute value.QName
getEffectiveQName()
Get effective qualified name for element (whether defined directly, or by reference).AllEnumSet
getFinal()
Get 'final' attribute.java.lang.String
getFixed()
Get 'fixed' attribute value.int
getForm()
Get 'form' attribute type code.java.lang.String
getFormText()
Get 'form' attribute name value.FilteredSegmentList
getIdentityConstraintList()
Get list of identity constraint child elements.Count
getMaxOccurs()
Get 'maxOccurs' attribute value.Count
getMinOccurs()
Get 'minOccurs' attribute value.java.lang.String
getName()
Get 'name' attribute value.QName
getQName()
Get qualified name set directly on element.QName
getRef()
Get 'ref' attribute value.ElementElement
getReference()
Get the referenced element declaration.QName
getSubstitutionGroup()
Get 'substitutionGroup' attribute value.QName
getType()
Get 'type' attribute value.CommonTypeDefinition
getTypeDefinition()
Get type definition.boolean
isAbstract()
Check 'abstract' attribute value.boolean
isInlineType()
Check if the element uses an inline type definition.boolean
isNillable()
Check 'nillable' attribute value.protected void
preset(IUnmarshallingContext ictx)
Pre-set method to be called by data binding while parsing element start tag.void
prevalidate(ValidationContext vctx)
Prevalidate component information.void
setAbstract(boolean abs)
Set 'abstract' attribute value.void
setDefault(java.lang.String dflt)
Set the 'default' attribute value.void
setFixed(java.lang.String fixed)
Set 'fixed' attribute value.void
setForm(int type)
Set 'form' attribute type code.void
setMaxOccurs(Count count)
Set 'maxOccurs' attribute value.void
setMinOccurs(Count count)
Get 'maxOccurs' attribute value.void
setName(java.lang.String name)
Set 'name' attribute value.void
setNillable(boolean nil)
Set 'nillable' attribute value.void
setRef(QName ref)
Set 'ref' attribute value.void
setSubstitutionGroup(QName qname)
Set 'substitutionGroup' attribute value.void
setType(QName type)
Set 'type' attribute value.void
setTypeDefinition(CommonTypeDefinition def)
Set type definition (either inline, or as reference).void
validate(ValidationContext vctx)
Validate component information.-
Methods inherited from class org.jibx.schema.elements.AnnotatedBase
getAnnotation, getId, setAnnotation, setId
-
Methods inherited from class org.jibx.schema.elements.OpenAttrBase
addExtraAttribute, clearExtraAttributes, compactChildren, detachChild, getChild, getChildCount, getChildIterator, getChildrenWritable, getExtraAttributes, preget, replaceChild, validateAttributes
-
Methods inherited from class org.jibx.schema.elements.SchemaBase
addNamespaceDeclaration, bit, clearNamespaceDeclarations, getExtension, getNamespaceDeclarations, getParent, getSchema, isGlobal, name, readNamespaces, setExtension, setParent, type, validateAttributes, writeNamespaces
-
-
-
-
Field Detail
-
s_allowedAttributes
public static final StringArray s_allowedAttributes
List of allowed attribute names.
-
INLINE_TYPE_MASK
private long INLINE_TYPE_MASK
Mask bits for inline type definition child.
-
IDENTITY_CONSTRAINT_MASK
private long IDENTITY_CONSTRAINT_MASK
Mask bits for identity constraint children.
-
EXTENSION_BLOCK
public static final int EXTENSION_BLOCK
- See Also:
- Constant Field Values
-
RESTRICTION_BLOCK
public static final int RESTRICTION_BLOCK
- See Also:
- Constant Field Values
-
SUBSTITUTION_BLOCK
public static final int SUBSTITUTION_BLOCK
- See Also:
- Constant Field Values
-
s_blockValues
public static final EnumSet s_blockValues
-
EXTENSION_FINAL
public static final int EXTENSION_FINAL
- See Also:
- Constant Field Values
-
RESTRICTION_FINAL
public static final int RESTRICTION_FINAL
- See Also:
- Constant Field Values
-
s_derivationValues
public static final EnumSet s_derivationValues
-
m_inlineTypeList
private final FilteredSegmentList m_inlineTypeList
Filtered list of inline type definition elements (zero or one only).
-
m_identityConstraintList
private final FilteredSegmentList m_identityConstraintList
Filtered list of identity constraint elements (zero or more).
-
m_defRef
private DefRefAttributeGroup m_defRef
Name or reference.
-
m_formChoice
private FormChoiceAttribute m_formChoice
Form of name.
-
m_occurs
private OccursAttributeGroup m_occurs
Occurs attribute group.
-
m_type
private QName m_type
'type' attribute value.
-
m_default
private java.lang.String m_default
'default' attribute value.
-
m_fixed
private java.lang.String m_fixed
'fixed' attribute value.
-
m_abstract
private boolean m_abstract
'abstract' attribute value.
-
m_nillable
private boolean m_nillable
'nillable' attribute value.
-
m_block
private AllEnumSet m_block
'block' attribute value.
-
m_final
private AllEnumSet m_final
'final' attribute value.
-
m_substitutionGroup
private QName m_substitutionGroup
'substitutionGroup' attribute information.
-
m_refElement
private ElementElement m_refElement
Element definition (from 'ref' attribute -null
if none).
-
m_typeDefinition
private CommonTypeDefinition m_typeDefinition
Complex or simple type definition (from 'type' attribute, or inline definition -null
if none).
-
m_qname
private QName m_qname
Qualified name (only defined after validation).
-
-
Method Detail
-
clearType
private void clearType()
Clear any type information. This method is only visible for internal use, to be called in the process of setting new type information.
-
preset
protected void preset(IUnmarshallingContext ictx) throws JiBXException
Description copied from class:SchemaBase
Pre-set method to be called by data binding while parsing element start tag. The base class implementation just sets the parent element link and reads in any extra namespaces defined on the element. Subclasses which override this implementation must call the base implementation during their processing.- Overrides:
preset
in classSchemaBase
- Parameters:
ictx
- unmarshalling context- Throws:
JiBXException
- on error
-
getType
public QName getType()
Get 'type' attribute value.- Returns:
- type (
null
if not set)
-
setType
public void setType(QName type)
Set 'type' attribute value. Note that this method should only be used prior to validation, since it will only set the type name and not link the actual type information.- Parameters:
type
- (null
if not set)
-
getDefault
public java.lang.String getDefault()
Get 'default' attribute value.- Returns:
- default (
null
if not set)
-
setDefault
public void setDefault(java.lang.String dflt)
Set the 'default' attribute value.- Parameters:
dflt
- (null
if not set)
-
getFixed
public java.lang.String getFixed()
Get 'fixed' attribute value.- Returns:
- fixed (
null
if not set)
-
setFixed
public void setFixed(java.lang.String fixed)
Set 'fixed' attribute value.- Parameters:
fixed
- (null
if not set)
-
isAbstract
public boolean isAbstract()
Check 'abstract' attribute value.- Returns:
- abstract attribute value
-
setAbstract
public void setAbstract(boolean abs)
Set 'abstract' attribute value.- Parameters:
abs
- abstract attribute value
-
isNillable
public boolean isNillable()
Check 'nillable' attribute value.- Returns:
- nillable attribute value (
null
if not set)
-
setNillable
public void setNillable(boolean nil)
Set 'nillable' attribute value.- Parameters:
nil
- nillable attribute value (null
if not set)
-
getFinal
public AllEnumSet getFinal()
Get 'final' attribute.- Returns:
- final
-
getBlock
public AllEnumSet getBlock()
Get 'block' attribute.- Returns:
- block
-
getSubstitutionGroup
public QName getSubstitutionGroup()
Get 'substitutionGroup' attribute value.- Returns:
- substitutionGroup (
null
if not set)
-
setSubstitutionGroup
public void setSubstitutionGroup(QName qname)
Set 'substitutionGroup' attribute value.- Parameters:
qname
- (null
if not set)
-
getReference
public ElementElement getReference()
Get the referenced element declaration. This method is only usable after validation.- Returns:
- referenced element definition, or
null
if not a reference
-
getQName
public QName getQName()
Get qualified name set directly on element. This method is only usable after prevalidation.
-
getEffectiveQName
public QName getEffectiveQName()
Get effective qualified name for element (whether defined directly, or by reference). This method is only usable after prevalidation.- Returns:
- qname
-
isInlineType
public boolean isInlineType()
Check if the element uses an inline type definition.- Returns:
true
if inline,false
if not
-
getTypeDefinition
public CommonTypeDefinition getTypeDefinition()
Get type definition. This returns the actual type definition for the element, irrespective of whether the element uses an element reference, a type reference, or an inline type definition. It is only usable after validation.- Returns:
- type definition (
null
if empty type definition)
-
setTypeDefinition
public void setTypeDefinition(CommonTypeDefinition def)
Set type definition (either inline, or as reference).- Parameters:
def
- inline type definition
-
getIdentityConstraintList
public FilteredSegmentList getIdentityConstraintList()
Get list of identity constraint child elements.- Returns:
- list
-
getName
public java.lang.String getName()
Get 'name' attribute value.- Specified by:
getName
in interfaceINamed
- Returns:
- name
- See Also:
DefRefAttributeGroup.getName()
-
getRef
public QName getRef()
Get 'ref' attribute value.- Specified by:
getRef
in interfaceIReference
- Returns:
- ref
- See Also:
DefRefAttributeGroup.getRef()
-
setName
public void setName(java.lang.String name)
Set 'name' attribute value.- Parameters:
name
-- See Also:
DefRefAttributeGroup.setName(java.lang.String)
-
setRef
public void setRef(QName ref)
Set 'ref' attribute value.- Parameters:
ref
-- See Also:
DefRefAttributeGroup.setRef(org.jibx.runtime.QName)
-
getForm
public int getForm()
Get 'form' attribute type code.- Returns:
- form
- See Also:
FormChoiceAttribute.getForm()
-
getFormText
public java.lang.String getFormText()
Get 'form' attribute name value.- Returns:
- form
- See Also:
FormChoiceAttribute.getFormText()
-
setForm
public void setForm(int type)
Set 'form' attribute type code.- Parameters:
type
-- See Also:
FormChoiceAttribute.setForm(int)
-
getMaxOccurs
public Count getMaxOccurs()
Get 'maxOccurs' attribute value.- Specified by:
getMaxOccurs
in interfaceIArity
- Returns:
- count
- See Also:
OccursAttributeGroup.getMaxOccurs()
-
getMinOccurs
public Count getMinOccurs()
Get 'minOccurs' attribute value.- Specified by:
getMinOccurs
in interfaceIArity
- Returns:
- count
- See Also:
OccursAttributeGroup.getMinOccurs()
-
setMaxOccurs
public void setMaxOccurs(Count count)
Set 'maxOccurs' attribute value.- Specified by:
setMaxOccurs
in interfaceIArity
- Parameters:
count
-- See Also:
OccursAttributeGroup.setMaxOccurs(org.jibx.schema.types.Count)
-
setMinOccurs
public void setMinOccurs(Count count)
Get 'maxOccurs' attribute value.- Specified by:
setMinOccurs
in interfaceIArity
- Parameters:
count
-- See Also:
OccursAttributeGroup.setMinOccurs(org.jibx.schema.types.Count)
-
prevalidate
public void prevalidate(ValidationContext vctx)
Description copied from class:SchemaBase
Prevalidate component information. The prevalidation step is used to check isolated aspects of a component, such as the settings for enumerated values. This empty base class implementation should be overridden by each subclass that requires prevalidation handling.- Specified by:
prevalidate
in interfaceIComponent
- Overrides:
prevalidate
in classAnnotatedBase
- Parameters:
vctx
- validation context
-
validate
public void validate(ValidationContext vctx)
Description copied from class:SchemaBase
Validate component information. The validation step is used for checking the interactions between components, such as name references to other components. TheSchemaBase.prevalidate(org.jibx.schema.validation.ValidationContext)
method will always be called for every component in the schema definition before this method is called for any component. This empty base class implementation should be overridden by each subclass that requires validation handling.- Specified by:
validate
in interfaceIComponent
- Overrides:
validate
in classSchemaBase
- Parameters:
vctx
- validation context
-
-