Class 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 Details

    • s_allowedAttributes

      public static final StringArray 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

      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 String m_default
      'default' attribute value.
    • m_fixed

      private 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 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

      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 String getDefault()
      Get 'default' attribute value.
      Returns:
      default (null if not set)
    • setDefault

      public void setDefault(String dflt)
      Set the 'default' attribute value.
      Parameters:
      dflt - (null if not set)
    • getFixed

      public String getFixed()
      Get 'fixed' attribute value.
      Returns:
      fixed (null if not set)
    • setFixed

      public void setFixed(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 String getUseText()
      Get 'use' attribute text.
      Returns:
      text (null if not set)
    • setUseText

      private void setUseText(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.
      Specified by:
      getQName in interface INamed
      Returns:
      qname (null if a reference)
    • 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 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 String getName()
      Get 'name' attribute value.
      Specified by:
      getName in interface INamed
      Returns:
      name
      See Also:
    • getRef

      public QName getRef()
      Get 'ref' attribute value.
      Specified by:
      getRef in interface IReference
      Returns:
      ref
      See Also:
    • setName

      public void setName(String name)
      Set 'name' attribute value.
      Parameters:
      name -
      See Also:
    • setRef

      public void setRef(QName ref)
      Set 'ref' attribute value.
      Parameters:
      ref -
      See Also:
    • getForm

      public int getForm()
      Get 'form' attribute type code.
      Returns:
      form
      See Also:
    • getFormText

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

      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