Package org.jibx.schema.elements
Class SchemaBase
java.lang.Object
org.jibx.schema.elements.SchemaBase
- All Implemented Interfaces:
IComponent
- Direct Known Subclasses:
AnnotationItem
,OpenAttrBase
Base class for all element structures in schema definition model. This just provides the linkages for the schema
definition tree structure and related validation hooks, along with support for extra namespaces.
- Author:
- Dennis M. Sosnoski
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final long[]
Bit masks for individual elements.static final String[]
Actual element names.static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
private Object
Extension data for application use.private ArrayList
Namespace definitions associated with this element (lazy create,null
if unused).private OpenAttrBase
Parent element.private final int
Element type code.static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
Fields inherited from interface org.jibx.schema.IComponent
SCHEMA_NAMESPACE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
addNamespaceDeclaration
(String prefix, String uri) Add namespace declaration.final long
bit()
Get element bit mask.final void
Clear namespace declarations list.abstract int
Get count of child elements.abstract Iterator
Get read-only iterator for child elements.Get extension data.final ArrayList
Get namespace declarations list.final OpenAttrBase
Get parent element.final SchemaElement
Get the ancestor schema element.final boolean
isGlobal()
Check if this element represents a global definition.final String
name()
Get element name.protected void
preget
(IMarshallingContext ictx) Pre-get method to be called by data binding while writing element start tag.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.protected void
Collect namespace declarations from element.void
setExtension
(Object extension) Set extension data.protected final void
setParent
(OpenAttrBase parent) Set parent element.final int
type()
Get element type.void
validate
(ValidationContext vctx) Validate component information.protected static void
validateAttributes
(IUnmarshallingContext ictx, boolean extra, StringArray attrs) Validate attributes of element.protected void
Write namespace declarations to element.
-
Field Details
-
ALL_TYPE
public static final int ALL_TYPE- See Also:
-
ANNOTATION_TYPE
public static final int ANNOTATION_TYPE- See Also:
-
ANY_TYPE
public static final int ANY_TYPE- See Also:
-
ANYATTRIBUTE_TYPE
public static final int ANYATTRIBUTE_TYPE- See Also:
-
APPINFO_TYPE
public static final int APPINFO_TYPE- See Also:
-
ATTRIBUTE_TYPE
public static final int ATTRIBUTE_TYPE- See Also:
-
ATTRIBUTEGROUP_TYPE
public static final int ATTRIBUTEGROUP_TYPE- See Also:
-
CHOICE_TYPE
public static final int CHOICE_TYPE- See Also:
-
COMPLEXCONTENT_TYPE
public static final int COMPLEXCONTENT_TYPE- See Also:
-
COMPLEXTYPE_TYPE
public static final int COMPLEXTYPE_TYPE- See Also:
-
DOCUMENTATION_TYPE
public static final int DOCUMENTATION_TYPE- See Also:
-
ELEMENT_TYPE
public static final int ELEMENT_TYPE- See Also:
-
ENUMERATION_TYPE
public static final int ENUMERATION_TYPE- See Also:
-
EXTENSION_TYPE
public static final int EXTENSION_TYPE- See Also:
-
FIELD_TYPE
public static final int FIELD_TYPE- See Also:
-
FRACTIONDIGITS_TYPE
public static final int FRACTIONDIGITS_TYPE- See Also:
-
GROUP_TYPE
public static final int GROUP_TYPE- See Also:
-
IMPORT_TYPE
public static final int IMPORT_TYPE- See Also:
-
INCLUDE_TYPE
public static final int INCLUDE_TYPE- See Also:
-
KEY_TYPE
public static final int KEY_TYPE- See Also:
-
KEYREF_TYPE
public static final int KEYREF_TYPE- See Also:
-
LENGTH_TYPE
public static final int LENGTH_TYPE- See Also:
-
LIST_TYPE
public static final int LIST_TYPE- See Also:
-
MAXEXCLUSIVE_TYPE
public static final int MAXEXCLUSIVE_TYPE- See Also:
-
MAXINCLUSIVE_TYPE
public static final int MAXINCLUSIVE_TYPE- See Also:
-
MAXLENGTH_TYPE
public static final int MAXLENGTH_TYPE- See Also:
-
MINEXCLUSIVE_TYPE
public static final int MINEXCLUSIVE_TYPE- See Also:
-
MININCLUSIVE_TYPE
public static final int MININCLUSIVE_TYPE- See Also:
-
MINLENGTH_TYPE
public static final int MINLENGTH_TYPE- See Also:
-
NOTATION_TYPE
public static final int NOTATION_TYPE- See Also:
-
PATTERN_TYPE
public static final int PATTERN_TYPE- See Also:
-
REDEFINE_TYPE
public static final int REDEFINE_TYPE- See Also:
-
RESTRICTION_TYPE
public static final int RESTRICTION_TYPE- See Also:
-
SCHEMA_TYPE
public static final int SCHEMA_TYPE- See Also:
-
SELECTOR_TYPE
public static final int SELECTOR_TYPE- See Also:
-
SEQUENCE_TYPE
public static final int SEQUENCE_TYPE- See Also:
-
SIMPLECONTENT_TYPE
public static final int SIMPLECONTENT_TYPE- See Also:
-
SIMPLETYPE_TYPE
public static final int SIMPLETYPE_TYPE- See Also:
-
TOTALDIGITS_TYPE
public static final int TOTALDIGITS_TYPE- See Also:
-
UNION_TYPE
public static final int UNION_TYPE- See Also:
-
UNIQUE_TYPE
public static final int UNIQUE_TYPE- See Also:
-
WHITESPACE_TYPE
public static final int WHITESPACE_TYPE- See Also:
-
ELEMENT_NAMES
Actual element names. -
ELEMENT_MASKS
public static final long[] ELEMENT_MASKSBit masks for individual elements. -
m_type
private final int m_typeElement type code. -
m_parent
Parent element. -
m_extension
Extension data for application use. -
m_namespaces
Namespace definitions associated with this element (lazy create,null
if unused).
-
-
Constructor Details
-
SchemaBase
protected SchemaBase(int type) Constructor.- Parameters:
type
- element type code
-
-
Method Details
-
type
public final int type()Get element type.- Returns:
- type code for this element
-
name
Get element name.- Returns:
- type code for this element
-
bit
public final long bit()Get element bit mask.- Returns:
- bit mask for this element
-
getParent
Get parent element.- Returns:
- parent element,
null
if none (schema element only)
-
setParent
Set parent element. This method is provided for use by subclasses and other classes in this package (particularlyFilteredSegmentList
).- Parameters:
parent
-
-
getSchema
Get the ancestor schema element. It is an error to call this method with an element which is not part of a schema, resulting in a runtime exception.- Returns:
- schema
-
isGlobal
public final boolean isGlobal()Check if this element represents a global definition.- Returns:
true
if global,false
if not
-
getExtension
Get extension data. The actual type of object used for extension data (if any) is defined by the application.- Returns:
- extension
-
setExtension
Set extension data. The actual type of object used for extension data (if any) is defined by the application.- Parameters:
extension
-
-
getNamespaceDeclarations
Get namespace declarations list. Entries in this list consist of pairs, consisting of namespace prefix followed by namespace URI. The empty string is used as the prefix for the default namespace.- Returns:
- extra attribute list
-
clearNamespaceDeclarations
public final void clearNamespaceDeclarations()Clear namespace declarations list. -
addNamespaceDeclaration
Add namespace declaration.- Parameters:
prefix
- namespace prefixuri
- namespace URI
-
getChildCount
public abstract int getChildCount()Get count of child elements.- Returns:
- child count
-
getChildIterator
Get read-only iterator for child elements.- Returns:
- iterator
-
preget
Pre-get method to be called by data binding while writing element start tag. The base class implementation just writes out any extra namespaces defined on the element. Subclasses which override this implementation must call the base implementation during their processing.- Parameters:
ictx
- marshalling context- Throws:
JiBXException
- on marshalling error
-
preset
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.- Parameters:
ictx
- unmarshalling context- Throws:
JiBXException
- on error
-
validateAttributes
protected static void validateAttributes(IUnmarshallingContext ictx, boolean extra, StringArray attrs) Validate attributes of element. This is designed to be called during unmarshalling as part of the pre-set method processing when a subclass instance is being created.- Parameters:
ictx
- unmarshalling contextextra
- allow extra attributes from other namespaces flagattrs
- attributes array- See Also:
-
readNamespaces
Collect namespace declarations from element. This is designed to be called during unmarshalling as part of the pre-set method processing when a subclass instance is being created.- Parameters:
ictx
- unmarshalling context
-
writeNamespaces
Write namespace declarations to element. This is designed to be called during marshalling as part of the pre-get method processing when a subclass instance is being marshalled.- Parameters:
ictx
- marshalling context- Throws:
JiBXException
- on error writing
-
prevalidate
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
- Parameters:
vctx
- validation context
-
validate
Validate component information. The validation step is used for checking the interactions between components, such as name references to other components. Theprevalidate(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
- Parameters:
vctx
- validation context
-