org.basex.api.xqj
Class BXQItemType

java.lang.Object
  extended by org.basex.api.xqj.BXQItemType
All Implemented Interfaces:
XQItemType, XQSequenceType

public final class BXQItemType
extends java.lang.Object
implements XQItemType

Java XQuery API - Item type.

Author:
Workgroup DBIS, University of Konstanz 2005-08, ISC License, Andreas Weiler

Field Summary
 
Fields inherited from interface javax.xml.xquery.XQItemType
XQBASETYPE_ANYATOMICTYPE, XQBASETYPE_ANYSIMPLETYPE, XQBASETYPE_ANYTYPE, XQBASETYPE_ANYURI, XQBASETYPE_BASE64BINARY, XQBASETYPE_BOOLEAN, XQBASETYPE_BYTE, XQBASETYPE_DATE, XQBASETYPE_DATETIME, XQBASETYPE_DAYTIMEDURATION, XQBASETYPE_DECIMAL, XQBASETYPE_DOUBLE, XQBASETYPE_DURATION, XQBASETYPE_ENTITIES, XQBASETYPE_ENTITY, XQBASETYPE_FLOAT, XQBASETYPE_GDAY, XQBASETYPE_GMONTH, XQBASETYPE_GMONTHDAY, XQBASETYPE_GYEAR, XQBASETYPE_GYEARMONTH, XQBASETYPE_HEXBINARY, XQBASETYPE_ID, XQBASETYPE_IDREF, XQBASETYPE_IDREFS, XQBASETYPE_INT, XQBASETYPE_INTEGER, XQBASETYPE_LANGUAGE, XQBASETYPE_LONG, XQBASETYPE_NAME, XQBASETYPE_NCNAME, XQBASETYPE_NEGATIVE_INTEGER, XQBASETYPE_NMTOKEN, XQBASETYPE_NMTOKENS, XQBASETYPE_NONNEGATIVE_INTEGER, XQBASETYPE_NONPOSITIVE_INTEGER, XQBASETYPE_NORMALIZED_STRING, XQBASETYPE_NOTATION, XQBASETYPE_POSITIVE_INTEGER, XQBASETYPE_QNAME, XQBASETYPE_SHORT, XQBASETYPE_STRING, XQBASETYPE_TIME, XQBASETYPE_TOKEN, XQBASETYPE_UNSIGNED_BYTE, XQBASETYPE_UNSIGNED_INT, XQBASETYPE_UNSIGNED_LONG, XQBASETYPE_UNSIGNED_SHORT, XQBASETYPE_UNTYPED, XQBASETYPE_UNTYPEDATOMIC, XQBASETYPE_YEARMONTHDURATION, XQITEMKIND_ATOMIC, XQITEMKIND_ATTRIBUTE, XQITEMKIND_COMMENT, XQITEMKIND_DOCUMENT, XQITEMKIND_DOCUMENT_ELEMENT, XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT, XQITEMKIND_ELEMENT, XQITEMKIND_ITEM, XQITEMKIND_NODE, XQITEMKIND_PI, XQITEMKIND_SCHEMA_ATTRIBUTE, XQITEMKIND_SCHEMA_ELEMENT, XQITEMKIND_TEXT
 
Fields inherited from interface javax.xml.xquery.XQSequenceType
OCC_EMPTY, OCC_EXACTLY_ONE, OCC_ONE_OR_MORE, OCC_ZERO_OR_MORE, OCC_ZERO_OR_ONE
 
Constructor Summary
BXQItemType(int b)
          Constructor.
BXQItemType(Type t)
          Constructor.
BXQItemType(Type t, javax.xml.namespace.QName n, int b)
          Constructor.
BXQItemType(Type t, javax.xml.namespace.QName n, int b, int o)
          Constructor.
 
Method Summary
 int getBaseType()
          Returns the basic pre-defined type of the item.
 int getItemKind()
          Returns the kind of the item.
 int getItemOccurrence()
          Returns the occurrence indicator for the item type.
 XQItemType getItemType()
          Returns the type of the item in the sequence type.
 javax.xml.namespace.QName getNodeName()
          Returns the name of the node in case the item kind is an XQITEMKIND_DOCUMENT_ELEMENT, XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT, XQITEMKIND_ELEMENT, XQITEMKIND_SCHEMA_ELEMENT, XQITEMKIND_ATTRIBUTE, or XQITEMKIND_SCHEMA_ATTRIBUTE.
 java.lang.String getPIName()
          Returns the name of the processing instruction type.
 java.net.URI getSchemaURI()
          Returns the schema location URI of the schema that contains the item's element or type definition.
 Type getType()
          Returns the item type.
 javax.xml.namespace.QName getTypeName()
          Represents a type name (global or local).
 boolean isAnonymousType()
          Represents whether the item type is an anonymous type in the schema.
 boolean isElementNillable()
          Returns whether the element type is nillable or not.
 java.lang.String toString()
          Returns a human-readable implementation-defined string representation of the item type.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.xml.xquery.XQItemType
equals, hashCode
 

Constructor Detail

BXQItemType

public BXQItemType(int b)
            throws org.basex.api.xqj.BXQException
Constructor.

Parameters:
b - item type
Throws:
BXQException - exception

BXQItemType

public BXQItemType(Type t)
Constructor.

Parameters:
t - type

BXQItemType

public BXQItemType(Type t,
                   javax.xml.namespace.QName n,
                   int b)
Constructor.

Parameters:
t - type
n - name
b - base type

BXQItemType

public BXQItemType(Type t,
                   javax.xml.namespace.QName n,
                   int b,
                   int o)
Constructor.

Parameters:
t - type
n - name
b - base type
o - occurrence
Method Detail

getBaseType

public int getBaseType()
                throws org.basex.api.xqj.BXQException
Description copied from interface: XQItemType
Returns the basic pre-defined type of the item. One of the XQBASETYPE_* constants.

Specified by:
getBaseType in interface XQItemType
Returns:
int one of the XQBASETYPE_* constants indicating the basic type of the item
Throws:
org.basex.api.xqj.BXQException

getItemKind

public int getItemKind()
Description copied from interface: XQItemType
Returns the kind of the item. One of the XQITEMKIND_* constants.

Specified by:
getItemKind in interface XQItemType
Returns:
int one of the XQITEMKIND_* constants indicating the basic kind of the item

getItemOccurrence

public int getItemOccurrence()
Description copied from interface: XQItemType
Returns the occurrence indicator for the item type. This method will always return the value XQSequenceType.OCC_EXACTLY_ONE.

Specified by:
getItemOccurrence in interface XQItemType
Specified by:
getItemOccurrence in interface XQSequenceType
Returns:
int indicating the occurrence indicator

getNodeName

public javax.xml.namespace.QName getNodeName()
                                      throws org.basex.api.xqj.BXQException
Description copied from interface: XQItemType
Returns the name of the node in case the item kind is an XQITEMKIND_DOCUMENT_ELEMENT, XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT, XQITEMKIND_ELEMENT, XQITEMKIND_SCHEMA_ELEMENT, XQITEMKIND_ATTRIBUTE, or XQITEMKIND_SCHEMA_ATTRIBUTE. For example, in the case of a type for element "foo" this will return the QName foo. For wildcard entries a null value will be returned.

Specified by:
getNodeName in interface XQItemType
Returns:
QName for the name of the element, attribute, or document element node. null if it is a wildcard
Throws:
org.basex.api.xqj.BXQException

getPIName

public java.lang.String getPIName()
                           throws org.basex.api.xqj.BXQException
Description copied from interface: XQItemType
Returns the name of the processing instruction type. As such the item kind of this XQItemType must be XQITEMKIND_PI.

Specified by:
getPIName in interface XQItemType
Returns:
the name of the processing instruction type. null if it is a wildcard
Throws:
org.basex.api.xqj.BXQException

getSchemaURI

public java.net.URI getSchemaURI()
Description copied from interface: XQItemType
Returns the schema location URI of the schema that contains the item's element or type definition. This method is implementation-definied and an implementation will return a null value if it does not support retrieving the schema location URI. If the item corresponds to a validated global element in a schema, the result will be the schema location URI to the XMLSchema containing the element definition. Otherwise if the item is a schema validated node, the result will be the schema location URI of the XMLSchema containing the type definition of that node. If the item is not schema validated, the result is null

Specified by:
getSchemaURI in interface XQItemType
Returns:
URI representing the schema location URI of the XMLSchema containing the global element definition or the type definition of the current item. null in case the item is not schema validated or if the implementation does not support retrieving the schema URI.

getType

public Type getType()
Returns the item type.

Returns:
type.

getTypeName

public javax.xml.namespace.QName getTypeName()
                                      throws org.basex.api.xqj.BXQException
Description copied from interface: XQItemType
Represents a type name (global or local). This can be used to represent specific type name such as, element foo of type hatsize. The schema type name is represented as a single QName. If the return type is an anonymous type, the actual QName value returned is implementation defined.

Specified by:
getTypeName in interface XQItemType
Returns:
the QName of the schema type in case of a user defined or anonoymous types. For a built-in type, returns a predefined type name as QName (e.g.xs:anyType, xs:decimal, etc). Cannot be null
Throws:
org.basex.api.xqj.BXQException

isAnonymousType

public boolean isAnonymousType()
Description copied from interface: XQItemType
Represents whether the item type is an anonymous type in the schema.

Specified by:
isAnonymousType in interface XQItemType
Returns:
true if the item type is an anonymous type in the schema, false otherwise

isElementNillable

public boolean isElementNillable()
Description copied from interface: XQItemType
Returns whether the element type is nillable or not.

Specified by:
isElementNillable in interface XQItemType
Returns:
true if the element type is nillable, false otherwise

getItemType

public XQItemType getItemType()
Description copied from interface: XQSequenceType
Returns the type of the item in the sequence type.

Specified by:
getItemType in interface XQSequenceType
Returns:
XQItemType representing the item type in the sequence. null is returned in case of an empty sequence.

toString

public java.lang.String toString()
Description copied from interface: XQItemType
Returns a human-readable implementation-defined string representation of the item type.

Specified by:
toString in interface XQItemType
Specified by:
toString in interface XQSequenceType
Overrides:
toString in class java.lang.Object
Returns:
String a string representation of the item type