org.jibx.schema.elements
Class AttributeElement

java.lang.Object
  extended by org.jibx.schema.elements.SchemaBase
      extended by org.jibx.schema.elements.OpenAttrBase
          extended by org.jibx.schema.elements.AnnotatedBase
              extended by 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
private  java.lang.String m_default
          'default' attribute value.
private  DefRefAttributeGroup m_defRef
          Name or reference.
private  java.lang.String m_fixed
          'fixed' attribute value.
private  FormChoiceAttribute m_formChoice
          Form of name.
private  FilteredSegmentList m_inlineTypeList
          Filtered list of inline type definition elements (zero or one only).
private  QName m_qname
          Qualified name.
private  AttributeElement m_refElement
          Attribute definition (from 'ref' attribute - null if none).
private  QName m_type
          'type' attribute value.
private  CommonTypeDefinition m_typeDefinition
          Simple type definition (from 'type' attribute, or inline definition - null if none).
private  int m_useType
          'use' attribute value type code.
static int OPTIONAL_USE
           
static int PROHIBITED_USE
           
static int REQUIRED_USE
           
static StringArray s_allowedAttributes
          List of allowed attribute names.
static EnumSet s_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
AttributeElement()
          Constructor.
 
Method Summary
private  void clearType()
          Clear any type information.
 java.lang.String getDefault()
          Get 'default' attribute value.
 java.lang.String getFixed()
          Get 'fixed' attribute value.
 int getForm()
          Get 'form' attribute type code.
 java.lang.String getFormText()
          Get 'form' attribute name value.
 java.lang.String getName()
          Get 'name' attribute value.
 QName getQName()
          Get qualified name for attribute.
 QName getRef()
          Get 'ref' attribute value.
 AttributeElement getReference()
          Get the referenced attribute declaration.
 QName getType()
          Get 'type' attribute value.
 CommonTypeDefinition getTypeDefinition()
          Get type definition.
 int getUse()
          Get 'use' attribute type code.
 java.lang.String getUseText()
          Get 'use' attribute text.
 boolean isInlineType()
          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(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 setName(java.lang.String name)
          Set 'name' attribute value.
 void setRef(QName ref)
          Set 'ref' attribute value.
 void setType(QName type)
          Set 'type' attribute value.
 void setTypeDefinition(CommonTypeDefinition def)
          Set type definition.
 void setUse(int code)
          Set 'use' attribute type code.
private  void setUseText(java.lang.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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 - null if none).


m_typeDefinition

private CommonTypeDefinition m_typeDefinition
Simple type definition (from 'type' attribute, or inline definition - null if none).


m_qname

private QName m_qname
Qualified name.

Constructor Detail

AttributeElement

public AttributeElement()
Constructor.

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 class SchemaBase
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)

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

public java.lang.String getUseText()
Get 'use' attribute text.

Returns:
text (null if 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 for attribute. This method is only usable after prevalidation.

Specified by:
getQName in interface INamed
Returns:
qname (null if a reference)

getReference

public AttributeElement 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

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:
getName in interface INamed
Returns:
name
See Also:
DefRefAttributeGroup.getName()

getRef

public QName getRef()
Get 'ref' attribute value.

Specified by:
getRef in interface IReference
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: 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 interface IComponent
Overrides:
prevalidate in class AnnotatedBase
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. The SchemaBase.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 interface IComponent
Overrides:
validate in class SchemaBase
Parameters:
vctx - validation context


Project Web Site