Package org.jibx.schema.elements
Class AttributeElement
java.lang.Object
org.jibx.schema.elements.SchemaBase
org.jibx.schema.elements.OpenAttrBase
org.jibx.schema.elements.AnnotatedBase
org.jibx.schema.elements.AttributeElement
- All Implemented Interfaces:
IComponent
,INamed
,IReference
Base representation for both local and global attribute element
definition.
- Author:
- Dennis M. Sosnoski
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
'default' attribute value.private DefRefAttributeGroup
Name or reference.private String
'fixed' attribute value.private FormChoiceAttribute
Form of name.private final FilteredSegmentList
Filtered list of inline type definition elements (zero or one only).private QName
Qualified name.private AttributeElement
Attribute definition (from 'ref' attribute -null
if none).private QName
'type' attribute value.private CommonTypeDefinition
Simple type definition (from 'type' attribute, or inline definition -null
if none).private int
'use' attribute value type code.static final int
static final int
static final int
static final StringArray
List of allowed attribute names.static final EnumSet
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 -
Method Summary
Modifier and TypeMethodDescriptionprivate void
Clear any type information.Get 'default' attribute value.Get effective qualified name for attribute (whether defined directly, or by reference).getFixed()
Get 'fixed' attribute value.int
getForm()
Get 'form' attribute type code.Get 'form' attribute name value.getName()
Get 'name' attribute value.getQName()
Get qualified name set directly on attribute.getRef()
Get 'ref' attribute value.Get the referenced attribute declaration.getType()
Get 'type' attribute value.Get type definition.int
getUse()
Get 'use' attribute type code.Get 'use' attribute text.boolean
Check if the attribute uses an inline type definition.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
setDefault
(String dflt) Set the 'default' attribute value.void
Set 'fixed' attribute value.void
setForm
(int type) Set 'form' attribute type code.void
Set 'name' attribute value.void
Set 'ref' attribute value.void
Set 'type' attribute value.void
Set type definition.void
setUse
(int code) Set 'use' attribute type code.private void
setUseText
(String text, IUnmarshallingContext ictx) Set 'use' attribute text.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 Details
-
s_allowedAttributes
List of allowed attribute names. -
OPTIONAL_USE
public static final int OPTIONAL_USE- See Also:
-
PROHIBITED_USE
public static final int PROHIBITED_USE- See Also:
-
REQUIRED_USE
public static final int REQUIRED_USE- See Also:
-
s_useValues
-
m_inlineTypeList
Filtered list of inline type definition elements (zero or one only). -
m_defRef
Name or reference. -
m_formChoice
Form of name. -
m_type
'type' attribute value. -
m_useType
private int m_useType'use' attribute value type code. -
m_default
'default' attribute value. -
m_fixed
'fixed' attribute value. -
m_refElement
Attribute definition (from 'ref' attribute -null
if none). -
m_typeDefinition
Simple type definition (from 'type' attribute, or inline definition -null
if none). -
m_qname
Qualified name.
-
-
Constructor Details
-
AttributeElement
public AttributeElement()Constructor.
-
-
Method Details
-
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
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
Get 'type' attribute value.- Returns:
- type (
null
if not set)
-
setType
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
Get 'default' attribute value.- Returns:
- default (
null
if not set)
-
setDefault
Set the 'default' attribute value.- Parameters:
dflt
- (null
if not set)
-
getFixed
Get 'fixed' attribute value.- Returns:
- fixed (
null
if not set)
-
setFixed
Set 'fixed' attribute value.- Parameters:
fixed
- (null
if not set)
-
getUse
public int getUse()Get 'use' attribute type code.- Returns:
- type code applied to this attribute
-
setUse
public void setUse(int code) Set 'use' attribute type code.- Parameters:
code
- (-1
to unset)
-
getUseText
Get 'use' attribute text.- Returns:
- text (
null
if not set)
-
setUseText
Set 'use' attribute text. This method is provided only for use when unmarshalling.- Parameters:
text
-ictx
-
-
getQName
Get qualified name set directly on attribute. This method is only usable after prevalidation. -
getEffectiveQName
Get effective qualified name for attribute (whether defined directly, or by reference). This method is only usable after prevalidation.- Returns:
- qname
-
getReference
Get the referenced attribute declaration. This method is only usable after validation.- Returns:
- referenced attribute declaration, or
null
if not a reference
-
isInlineType
public boolean isInlineType()Check if the attribute uses an inline type definition.- Returns:
true
if inline,false
if not
-
getTypeDefinition
Get type definition. This returns the actual type definition for the attribute, irrespective of whether the attribute uses an attribute reference, a type reference, or an inline type definition. It is only usable after validation.- Returns:
- type definition
-
setTypeDefinition
Set type definition. If the supplied type definition is a global type it is used by reference; if a local type it is used inline.- Parameters:
def
- type definition
-
getName
Get 'name' attribute value. -
getRef
Get 'ref' attribute value.- Specified by:
getRef
in interfaceIReference
- Returns:
- ref
- See Also:
-
setName
Set 'name' attribute value.- Parameters:
name
-- See Also:
-
setRef
Set 'ref' attribute value.- Parameters:
ref
-- See Also:
-
getForm
public int getForm()Get 'form' attribute type code.- Returns:
- form
- See Also:
-
getFormText
Get 'form' attribute name value.- Returns:
- form
- See Also:
-
setForm
public void setForm(int type) Set 'form' attribute type code.- Parameters:
type
-- See Also:
-
prevalidate
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
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
-