Package org.jibx.schema.elements
Class SchemaBase
- java.lang.Object
-
- org.jibx.schema.elements.SchemaBase
-
- All Implemented Interfaces:
IComponent
- Direct Known Subclasses:
AnnotationItem,OpenAttrBase
public abstract class SchemaBase extends Object implements IComponent
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
Fields Modifier and Type Field Description static intALL_TYPEstatic intANNOTATION_TYPEstatic intANY_TYPEstatic intANYATTRIBUTE_TYPEstatic intAPPINFO_TYPEstatic intATTRIBUTE_TYPEstatic intATTRIBUTEGROUP_TYPEstatic intCHOICE_TYPEstatic intCOMPLEXCONTENT_TYPEstatic intCOMPLEXTYPE_TYPEstatic intDOCUMENTATION_TYPEstatic long[]ELEMENT_MASKSBit masks for individual elements.static String[]ELEMENT_NAMESActual element names.static intELEMENT_TYPEstatic intENUMERATION_TYPEstatic intEXTENSION_TYPEstatic intFIELD_TYPEstatic intFRACTIONDIGITS_TYPEstatic intGROUP_TYPEstatic intIMPORT_TYPEstatic intINCLUDE_TYPEstatic intKEY_TYPEstatic intKEYREF_TYPEstatic intLENGTH_TYPEstatic intLIST_TYPEstatic intMAXEXCLUSIVE_TYPEstatic intMAXINCLUSIVE_TYPEstatic intMAXLENGTH_TYPEstatic intMINEXCLUSIVE_TYPEstatic intMININCLUSIVE_TYPEstatic intMINLENGTH_TYPEstatic intNOTATION_TYPEstatic intPATTERN_TYPEstatic intREDEFINE_TYPEstatic intRESTRICTION_TYPEstatic intSCHEMA_TYPEstatic intSELECTOR_TYPEstatic intSEQUENCE_TYPEstatic intSIMPLECONTENT_TYPEstatic intSIMPLETYPE_TYPEstatic intTOTALDIGITS_TYPEstatic intUNION_TYPEstatic intUNIQUE_TYPEstatic intWHITESPACE_TYPE-
Fields inherited from interface org.jibx.schema.IComponent
SCHEMA_NAMESPACE
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSchemaBase(int type)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddNamespaceDeclaration(String prefix, String uri)Add namespace declaration.longbit()Get element bit mask.voidclearNamespaceDeclarations()Clear namespace declarations list.abstract intgetChildCount()Get count of child elements.abstract IteratorgetChildIterator()Get read-only iterator for child elements.ObjectgetExtension()Get extension data.ArrayListgetNamespaceDeclarations()Get namespace declarations list.OpenAttrBasegetParent()Get parent element.SchemaElementgetSchema()Get the ancestor schema element.booleanisGlobal()Check if this element represents a global definition.Stringname()Get element name.protected voidpreget(org.jibx.runtime.IMarshallingContext ictx)Pre-get method to be called by data binding while writing element start tag.protected voidpreset(org.jibx.runtime.IUnmarshallingContext ictx)Pre-set method to be called by data binding while parsing element start tag.voidprevalidate(ValidationContext vctx)Prevalidate component information.protected voidreadNamespaces(org.jibx.runtime.IUnmarshallingContext ictx)Collect namespace declarations from element.voidsetExtension(Object extension)Set extension data.protected voidsetParent(OpenAttrBase parent)Set parent element.inttype()Get element type.voidvalidate(ValidationContext vctx)Validate component information.protected static voidvalidateAttributes(org.jibx.runtime.IUnmarshallingContext ictx, boolean extra, org.jibx.util.StringArray attrs)Validate attributes of element.protected voidwriteNamespaces(org.jibx.runtime.IMarshallingContext ictx)Write namespace declarations to element.
-
-
-
Field Detail
-
ALL_TYPE
public static final int ALL_TYPE
- See Also:
- Constant Field Values
-
ANNOTATION_TYPE
public static final int ANNOTATION_TYPE
- See Also:
- Constant Field Values
-
ANY_TYPE
public static final int ANY_TYPE
- See Also:
- Constant Field Values
-
ANYATTRIBUTE_TYPE
public static final int ANYATTRIBUTE_TYPE
- See Also:
- Constant Field Values
-
APPINFO_TYPE
public static final int APPINFO_TYPE
- See Also:
- Constant Field Values
-
ATTRIBUTE_TYPE
public static final int ATTRIBUTE_TYPE
- See Also:
- Constant Field Values
-
ATTRIBUTEGROUP_TYPE
public static final int ATTRIBUTEGROUP_TYPE
- See Also:
- Constant Field Values
-
CHOICE_TYPE
public static final int CHOICE_TYPE
- See Also:
- Constant Field Values
-
COMPLEXCONTENT_TYPE
public static final int COMPLEXCONTENT_TYPE
- See Also:
- Constant Field Values
-
COMPLEXTYPE_TYPE
public static final int COMPLEXTYPE_TYPE
- See Also:
- Constant Field Values
-
DOCUMENTATION_TYPE
public static final int DOCUMENTATION_TYPE
- See Also:
- Constant Field Values
-
ELEMENT_TYPE
public static final int ELEMENT_TYPE
- See Also:
- Constant Field Values
-
ENUMERATION_TYPE
public static final int ENUMERATION_TYPE
- See Also:
- Constant Field Values
-
EXTENSION_TYPE
public static final int EXTENSION_TYPE
- See Also:
- Constant Field Values
-
FIELD_TYPE
public static final int FIELD_TYPE
- See Also:
- Constant Field Values
-
FRACTIONDIGITS_TYPE
public static final int FRACTIONDIGITS_TYPE
- See Also:
- Constant Field Values
-
GROUP_TYPE
public static final int GROUP_TYPE
- See Also:
- Constant Field Values
-
IMPORT_TYPE
public static final int IMPORT_TYPE
- See Also:
- Constant Field Values
-
INCLUDE_TYPE
public static final int INCLUDE_TYPE
- See Also:
- Constant Field Values
-
KEY_TYPE
public static final int KEY_TYPE
- See Also:
- Constant Field Values
-
KEYREF_TYPE
public static final int KEYREF_TYPE
- See Also:
- Constant Field Values
-
LENGTH_TYPE
public static final int LENGTH_TYPE
- See Also:
- Constant Field Values
-
LIST_TYPE
public static final int LIST_TYPE
- See Also:
- Constant Field Values
-
MAXEXCLUSIVE_TYPE
public static final int MAXEXCLUSIVE_TYPE
- See Also:
- Constant Field Values
-
MAXINCLUSIVE_TYPE
public static final int MAXINCLUSIVE_TYPE
- See Also:
- Constant Field Values
-
MAXLENGTH_TYPE
public static final int MAXLENGTH_TYPE
- See Also:
- Constant Field Values
-
MINEXCLUSIVE_TYPE
public static final int MINEXCLUSIVE_TYPE
- See Also:
- Constant Field Values
-
MININCLUSIVE_TYPE
public static final int MININCLUSIVE_TYPE
- See Also:
- Constant Field Values
-
MINLENGTH_TYPE
public static final int MINLENGTH_TYPE
- See Also:
- Constant Field Values
-
NOTATION_TYPE
public static final int NOTATION_TYPE
- See Also:
- Constant Field Values
-
PATTERN_TYPE
public static final int PATTERN_TYPE
- See Also:
- Constant Field Values
-
REDEFINE_TYPE
public static final int REDEFINE_TYPE
- See Also:
- Constant Field Values
-
RESTRICTION_TYPE
public static final int RESTRICTION_TYPE
- See Also:
- Constant Field Values
-
SCHEMA_TYPE
public static final int SCHEMA_TYPE
- See Also:
- Constant Field Values
-
SELECTOR_TYPE
public static final int SELECTOR_TYPE
- See Also:
- Constant Field Values
-
SEQUENCE_TYPE
public static final int SEQUENCE_TYPE
- See Also:
- Constant Field Values
-
SIMPLECONTENT_TYPE
public static final int SIMPLECONTENT_TYPE
- See Also:
- Constant Field Values
-
SIMPLETYPE_TYPE
public static final int SIMPLETYPE_TYPE
- See Also:
- Constant Field Values
-
TOTALDIGITS_TYPE
public static final int TOTALDIGITS_TYPE
- See Also:
- Constant Field Values
-
UNION_TYPE
public static final int UNION_TYPE
- See Also:
- Constant Field Values
-
UNIQUE_TYPE
public static final int UNIQUE_TYPE
- See Also:
- Constant Field Values
-
WHITESPACE_TYPE
public static final int WHITESPACE_TYPE
- See Also:
- Constant Field Values
-
ELEMENT_NAMES
public static final String[] ELEMENT_NAMES
Actual element names.
-
ELEMENT_MASKS
public static final long[] ELEMENT_MASKS
Bit masks for individual elements.
-
-
Method Detail
-
type
public final int type()
Get element type.- Returns:
- type code for this element
-
name
public final String 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
public final OpenAttrBase getParent()
Get parent element.- Returns:
- parent element,
nullif none (schema element only)
-
setParent
protected final void setParent(OpenAttrBase parent)
Set parent element. This method is provided for use by subclasses and other classes in this package (particularlyFilteredSegmentList).- Parameters:
parent- Parent
-
getSchema
public final SchemaElement 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:
trueif global,falseif not
-
getExtension
public Object getExtension()
Get extension data. The actual type of object used for extension data (if any) is defined by the application.- Returns:
- extension
-
setExtension
public void setExtension(Object extension)
Set extension data. The actual type of object used for extension data (if any) is defined by the application.- Parameters:
extension- data
-
getNamespaceDeclarations
public final ArrayList 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
public final void addNamespaceDeclaration(String prefix, String uri)
Add namespace declaration.- Parameters:
prefix- namespace prefixuri- namespace URI
-
getChildCount
public abstract int getChildCount()
Get count of child elements.- Returns:
- child count
-
getChildIterator
public abstract Iterator getChildIterator()
Get read-only iterator for child elements.- Returns:
- iterator
-
preget
protected void preget(org.jibx.runtime.IMarshallingContext ictx) throws org.jibx.runtime.JiBXExceptionPre-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:
org.jibx.runtime.JiBXException- on marshalling error
-
preset
protected void preset(org.jibx.runtime.IUnmarshallingContext ictx) throws org.jibx.runtime.JiBXExceptionPre-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:
org.jibx.runtime.JiBXException- on error
-
validateAttributes
protected static void validateAttributes(org.jibx.runtime.IUnmarshallingContext ictx, boolean extra, org.jibx.util.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:
preset(IUnmarshallingContext)
-
readNamespaces
protected void readNamespaces(org.jibx.runtime.IUnmarshallingContext ictx)
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
protected void writeNamespaces(org.jibx.runtime.IMarshallingContext ictx) throws org.jibx.runtime.JiBXExceptionWrite 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:
org.jibx.runtime.JiBXException- on error writing
-
prevalidate
public void prevalidate(ValidationContext vctx)
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:
prevalidatein interfaceIComponent- Parameters:
vctx- validation context
-
validate
public void validate(ValidationContext vctx)
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:
validatein interfaceIComponent- Parameters:
vctx- validation context
-
-