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
public class AttributeElement extends AnnotatedBase implements INamed, IReference
Base representation for both local and global attribute element definition.- Author:
- Dennis M. Sosnoski
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringm_default'default' attribute value.private DefRefAttributeGroupm_defRefName or reference.private java.lang.Stringm_fixed'fixed' attribute value.private FormChoiceAttributem_formChoiceForm of name.private FilteredSegmentListm_inlineTypeListFiltered list of inline type definition elements (zero or one only).private QNamem_qnameQualified name.private AttributeElementm_refElementAttribute definition (from 'ref' attribute -nullif none).private QNamem_type'type' attribute value.private CommonTypeDefinitionm_typeDefinitionSimple type definition (from 'type' attribute, or inline definition -nullif none).private intm_useType'use' attribute value type code.static intOPTIONAL_USEstatic intPROHIBITED_USEstatic intREQUIRED_USEstatic StringArrays_allowedAttributesList of allowed attribute names.static EnumSets_useValues-
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 AttributeElement()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidclearType()Clear any type information.java.lang.StringgetDefault()Get 'default' attribute value.QNamegetEffectiveQName()Get effective qualified name for attribute (whether defined directly, or by reference).java.lang.StringgetFixed()Get 'fixed' attribute value.intgetForm()Get 'form' attribute type code.java.lang.StringgetFormText()Get 'form' attribute name value.java.lang.StringgetName()Get 'name' attribute value.QNamegetQName()Get qualified name set directly on attribute.QNamegetRef()Get 'ref' attribute value.AttributeElementgetReference()Get the referenced attribute declaration.QNamegetType()Get 'type' attribute value.CommonTypeDefinitiongetTypeDefinition()Get type definition.intgetUse()Get 'use' attribute type code.java.lang.StringgetUseText()Get 'use' attribute text.booleanisInlineType()Check if the attribute uses an inline type definition.protected voidpreset(IUnmarshallingContext ictx)Pre-set method to be called by data binding while parsing element start tag.voidprevalidate(ValidationContext vctx)Prevalidate component information.voidsetDefault(java.lang.String dflt)Set the 'default' attribute value.voidsetFixed(java.lang.String fixed)Set 'fixed' attribute value.voidsetForm(int type)Set 'form' attribute type code.voidsetName(java.lang.String name)Set 'name' attribute value.voidsetRef(QName ref)Set 'ref' attribute value.voidsetType(QName type)Set 'type' attribute value.voidsetTypeDefinition(CommonTypeDefinition def)Set type definition.voidsetUse(int code)Set 'use' attribute type code.private voidsetUseText(java.lang.String text, IUnmarshallingContext ictx)Set 'use' attribute text.voidvalidate(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.
-
OPTIONAL_USE
public static final int OPTIONAL_USE
- See Also:
- Constant Field Values
-
PROHIBITED_USE
public static final int PROHIBITED_USE
- See Also:
- Constant Field Values
-
REQUIRED_USE
public static final int REQUIRED_USE
- See Also:
- Constant Field Values
-
s_useValues
public static final EnumSet s_useValues
-
m_inlineTypeList
private final FilteredSegmentList m_inlineTypeList
Filtered list of inline type definition elements (zero or one only).
-
m_defRef
private DefRefAttributeGroup m_defRef
Name or reference.
-
m_formChoice
private FormChoiceAttribute m_formChoice
Form of name.
-
m_type
private QName m_type
'type' attribute value.
-
m_useType
private int m_useType
'use' attribute value type code.
-
m_default
private java.lang.String m_default
'default' attribute value.
-
m_fixed
private java.lang.String m_fixed
'fixed' attribute value.
-
m_refElement
private AttributeElement m_refElement
Attribute definition (from 'ref' attribute -nullif none).
-
m_typeDefinition
private CommonTypeDefinition m_typeDefinition
Simple type definition (from 'type' attribute, or inline definition -nullif none).
-
m_qname
private QName m_qname
Qualified name.
-
-
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:SchemaBasePre-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:
presetin classSchemaBase- Parameters:
ictx- unmarshalling context- Throws:
JiBXException- on error
-
getType
public QName getType()
Get 'type' attribute value.- Returns:
- type (
nullif 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- (nullif not set)
-
getDefault
public java.lang.String getDefault()
Get 'default' attribute value.- Returns:
- default (
nullif not set)
-
setDefault
public void setDefault(java.lang.String dflt)
Set the 'default' attribute value.- Parameters:
dflt- (nullif not set)
-
getFixed
public java.lang.String getFixed()
Get 'fixed' attribute value.- Returns:
- fixed (
nullif not set)
-
setFixed
public void setFixed(java.lang.String fixed)
Set 'fixed' attribute value.- Parameters:
fixed- (nullif 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- (-1to unset)
-
getUseText
public java.lang.String getUseText()
Get 'use' attribute text.- Returns:
- text (
nullif not set)
-
setUseText
private void setUseText(java.lang.String text, IUnmarshallingContext ictx)Set 'use' attribute text. This method is provided only for use when unmarshalling.- Parameters:
text-ictx-
-
getQName
public QName getQName()
Get qualified name set directly on attribute. This method is only usable after prevalidation.
-
getEffectiveQName
public QName getEffectiveQName()
Get effective qualified name for attribute (whether defined directly, or by reference). This method is only usable after prevalidation.- Returns:
- qname
-
getReference
public AttributeElement getReference()
Get the referenced attribute declaration. This method is only usable after validation.- Returns:
- referenced attribute declaration, or
nullif not a reference
-
isInlineType
public boolean isInlineType()
Check if the attribute uses an inline type definition.- Returns:
trueif inline,falseif not
-
getTypeDefinition
public CommonTypeDefinition 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
public void setTypeDefinition(CommonTypeDefinition def)
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
public java.lang.String getName()
Get 'name' attribute value.- Specified by:
getNamein interfaceINamed- Returns:
- name
- See Also:
DefRefAttributeGroup.getName()
-
getRef
public QName getRef()
Get 'ref' attribute value.- Specified by:
getRefin 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)
-
prevalidate
public void prevalidate(ValidationContext vctx)
Description copied from class:SchemaBasePrevalidate 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:
prevalidatein interfaceIComponent- Overrides:
prevalidatein classAnnotatedBase- Parameters:
vctx- validation context
-
validate
public void validate(ValidationContext vctx)
Description copied from class:SchemaBaseValidate 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:
validatein interfaceIComponent- Overrides:
validatein classSchemaBase- Parameters:
vctx- validation context
-
-