APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xpath.internal.objects

public Class XObject

extends Expression
implements Serializable, Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable, java.io.Serializable
Known Direct Subclasses
com.sun.org.apache.xpath.internal.objects.XRTreeFrag, com.sun.org.apache.xpath.internal.objects.XString, com.sun.org.apache.xpath.internal.axes.NodeSequence, com.sun.org.apache.xpath.internal.objects.XBoolean, com.sun.org.apache.xpath.internal.objects.XNumber
Imports
com.sun.org.apache.xalan.internal.res.XSLMessages, com.sun.org.apache.xml.internal.dtm.DTM, .DTMIterator, com.sun.org.apache.xml.internal.utils.QName, .XMLString, com.sun.org.apache.xpath.internal.Expression, .ExpressionOwner, .NodeSetDTM, .XPathContext, .XPathException, .XPathVisitor, com.sun.org.apache.xpath.internal.res.XPATHErrorResources, java.io.Serializable, java.util.List, org.w3c.dom.DocumentFragment, .NodeList, org.w3c.dom.traversal.NodeIterator

This class represents an XPath object, and is capable of converting the object to various types, such as a string. This class acts as the base class to other XPath type objects, such as XString, and provides polymorphic casting capabilities.

Field Summary

Modifier and TypeField and Description
public static final int
CLASS_BOOLEAN

Constant for BOOLEAN object type

public static final int
CLASS_NODESET

Constant for NODESET object type

public static final int
CLASS_NULL

Constant for NULL object type

public static final int
CLASS_NUMBER

Constant for NUMBER object type

public static final int
CLASS_RTREEFRAG

Constant for RESULT TREE FRAGMENT object type

public static final int
CLASS_STRING

Constant for STRING object type

public static final int
CLASS_UNKNOWN

Constant for UNKNOWN object type

public static final int
CLASS_UNRESOLVEDVARIABLE

Represents an unresolved variable type as an integer.

protected Object
m_obj

The java object which this object wraps.

pack-priv static final long

Constructor Summary

AccessConstructor and Description
public
XObject()

Create an XObject.

public
XObject(Object
Can be any object, should be a specific type for derived classes, or null.
obj
)

Create an XObject.

Method Summary

Modifier and TypeMethod and Description
public void
allowDetachToRelease(boolean
true if it is OK for detach to release this iterator for pooling.
allowRelease
)

Specify if it's OK for detach to release the iterator for reuse.

public void

Returns:

The string this wraps or the empty string if null
appendToFsb
(FastStringBuffer fsb)

Cast result object to a string.

public boolean

Returns:

false
bool
()

Cast result object to a boolean.

public boolean

Returns:

True if there is a next node in the nodeset
boolWithSideEffects
()

Cast result object to a boolean, but allow side effects, such as the incrementing of an iterator.

public void
callVisitors(ExpressionOwner owner, XPathVisitor visitor)

Implements com.sun.org.apache.xpath.internal.XPathVisitable.callVisitors.

This will traverse the heararchy, calling the visitor for each member.

public Object

Returns:

This object as the given type t
castToType
(int
Type of object to cast this to
t
,
XPathContext
XPath context to use for the conversion
support
)

Cast object to type t.

public static XObject

Returns:

the right XObject based on the type of the object passed.
create
(Object
The java object which this object will wrap.
val
)

Create the right XObject based on the type of the object passed.

public static XObject

Returns:

the right XObject based on the type of the object passed.
create
(Object
The java object which this object will wrap.
val
,
XPathContext
The XPath context.
xctxt
)

Create the right XObject based on the type of the object passed.</emph>

public boolean
deepEquals(Expression expr)

Implements abstract com.sun.org.apache.xpath.internal.Expression.deepEquals.

Compare this object with another object and see if they are equal, include the sub heararchy.

public void
destruct()

Forces the object to release it's resources.

public void
detach()

Detaches the DTMIterator from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state.

public void
dispatchCharactersEvents(ContentHandler
A non-null reference to a ContentHandler.
ch
)

Directly call the characters method on the passed ContentHandler for the string-value.

public boolean

Returns:

True if this object is equal to the given object
equals
(XObject
Object to compare this to
obj2
)

Tell if two objects are functionally equal.

protected void
error(String
Error message to issue
msg
)

Tell the user of an error, and probably throw an exception.

protected void
error(String
Error message to issue
msg
,
Object[]
Arguments to use in the message
args
)

Tell the user of an error, and probably throw an exception.

public XObject

Returns:

This object.
execute
(XPathContext
The XPath execution context.
xctxt
)

Implements abstract com.sun.org.apache.xpath.internal.Expression.execute.

For support of literal objects in xpaths.

public void
fixupVariables(List<QName> vars, int globalsSize)

Implements abstract com.sun.org.apache.xpath.internal.Expression.fixupVariables.

XObjects should not normally need to fix up variables.

public XObject

Returns:

This object, unless overridden by subclass.
getFresh
()

Get a fresh copy of the object.

public int

Returns:

CLASS_UNKNOWN
getType
()

Tell what kind of class this is.

public String

Returns:

type string "#UNKNOWN" + object class name
getTypeString
()

Given a request type, return the equivalent string.

public boolean

Returns:

True if this object is greater than the given object
greaterThan
(XObject
Object to compare this to
obj2
)

Tell if one object is greater than the other.

public boolean

Returns:

True if this object is greater than or equal to the given object
greaterThanOrEqual
(XObject
Object to compare this to
obj2
)

Tell if one object is greater than or equal to the other.

public DTMIterator

Returns:

null
iter
()

Cast result object to a nodelist.

public boolean

Returns:

True if this object is less than the given object
lessThan
(XObject
Object to compare this to
obj2
)

Tell if one object is less than the other.

public boolean

Returns:

True if this object is less than or equal to the given object
lessThanOrEqual
(XObject
Object to compare this to
obj2
)

Tell if one object is less than or equal to the other.

public NodeSetDTM

Returns:

The object as a NodeSetDTM.
mutableNodeset
()

Cast result object to a nodelist.

public NodeList

Returns:

null
nodelist
()

Cast result object to a nodelist.

public NodeIterator

Returns:

null
nodeset
()

Cast result object to a nodelist.

public boolean

Returns:

True if this object is not equal to the given object
notEquals
(XObject
Object to compare this to
obj2
)

Tell if two objects are functionally not equal.

public double

Returns:

0.0
num
()

Cast result object to a number.

public double

Returns:

numeric value of the string conversion from the next node in the NodeSetDTM, or NAN if no node was found
numWithSideEffects
()

Cast result object to a number, but allow side effects, such as the incrementing of an iterator.

public Object

Returns:

The object that this class wraps
object
()

Return a java object that's closest to the representation that should be handed to an extension.

public void
reset()

Reset for fresh reuse.

public int

Returns:

the objec as a result tree fragment.
rtf
(XPathContext
XPath context to use for the conversion
support
)

Cast result object to a result tree fragment.

public int

Returns:

null
rtf
()

For functions to override.

public DocumentFragment

Returns:

the objec as a result tree fragment.
rtree
(XPathContext
XPath context to use for the conversion
support
)

Cast result object to a result tree fragment.

public DocumentFragment

Returns:

null
rtree
()

For functions to override.

protected void
public String

Returns:

The object as a string
str
()

Cast result object to a string.

public String

Returns:

the string representation of the object
toString
()

Overrides java.lang.Object.toString.

Return the string representation of the object

public XMLString

Returns:

The string this wraps or the empty string if null
xstr
()

Cast result object to a string.

Inherited from com.sun.org.apache.xpath.internal.Expression:
asIteratorasIteratorRawasNodeassertionboolcanTraverseOutsideSubtreeerrorexecuteexecuteexecuteexecuteCharsToContentHandlerexprAddChildexprGetChildexprGetNumChildrenexprGetParentexprSetParentgetColumnNumbergetExpressionOwnergetLineNumbergetPublicIdgetSystemIdisNodesetExprisSameClassisStableNumbernumwarnxstr

Field Detail

CLASS_BOOLEANback to summary
public static final int CLASS_BOOLEAN

Constant for BOOLEAN object type

CLASS_NODESETback to summary
public static final int CLASS_NODESET

Constant for NODESET object type

CLASS_NULLback to summary
public static final int CLASS_NULL

Constant for NULL object type

CLASS_NUMBERback to summary
public static final int CLASS_NUMBER

Constant for NUMBER object type

CLASS_RTREEFRAGback to summary
public static final int CLASS_RTREEFRAG

Constant for RESULT TREE FRAGMENT object type

CLASS_STRINGback to summary
public static final int CLASS_STRING

Constant for STRING object type

CLASS_UNKNOWNback to summary
public static final int CLASS_UNKNOWN

Constant for UNKNOWN object type

CLASS_UNRESOLVEDVARIABLEback to summary
public static final int CLASS_UNRESOLVEDVARIABLE

Represents an unresolved variable type as an integer.

m_objback to summary
protected Object m_obj

The java object which this object wraps.

Annotations
@SuppressWarnings:serial
serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides com.sun.org.apache.xpath.internal.Expression.serialVersionUID.

Constructor Detail

XObjectback to summary
public XObject()

Create an XObject.

XObjectback to summary
public XObject(Object obj)

Create an XObject.

Parameters
obj:Object

Can be any object, should be a specific type for derived classes, or null.

Method Detail

allowDetachToReleaseback to summary
public void allowDetachToRelease(boolean allowRelease)

Specify if it's OK for detach to release the iterator for reuse. This function should be called with a value of false for objects that are stored in variables. Calling this with a value of false on a XNodeSet will cause the nodeset to be cached.

Parameters
allowRelease:boolean

true if it is OK for detach to release this iterator for pooling.

appendToFsbback to summary
public void appendToFsb(FastStringBuffer fsb)

Cast result object to a string. NEEDSDOC @param fsb

Returns:void

The string this wraps or the empty string if null

boolback to summary
public boolean bool() throws TransformerException

Cast result object to a boolean. Always issues an error.

Returns:boolean

false

boolWithSideEffectsback to summary
public boolean boolWithSideEffects() throws TransformerException

Cast result object to a boolean, but allow side effects, such as the incrementing of an iterator.

Returns:boolean

True if there is a next node in the nodeset

callVisitorsback to summary
public void callVisitors(ExpressionOwner owner, XPathVisitor visitor)

Implements com.sun.org.apache.xpath.internal.XPathVisitable.callVisitors.

Doc from com.sun.org.apache.xpath.internal.XPathVisitable.callVisitors.

This will traverse the heararchy, calling the visitor for each member. If the called visitor method returns false, the subtree should not be called.

See Also
com.sun.org.apache.xpath.internal.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor)
castToTypeback to summary
public Object castToType(int t, XPathContext support) throws TransformerException

Cast object to type t.

Parameters
t:int

Type of object to cast this to

support:XPathContext

XPath context to use for the conversion

Returns:Object

This object as the given type t

createback to summary
public static XObject create(Object val)

Create the right XObject based on the type of the object passed. This function can not make an XObject that exposes DOM Nodes, NodeLists, and NodeIterators to the XSLT stylesheet as node-sets.

Parameters
val:Object

The java object which this object will wrap.

Returns:XObject

the right XObject based on the type of the object passed.

createback to summary
public static XObject create(Object val, XPathContext xctxt)

Create the right XObject based on the type of the object passed. This function can make an XObject that exposes DOM Nodes, NodeLists, and NodeIterators to the XSLT stylesheet as node-sets.

Parameters
val:Object

The java object which this object will wrap.

xctxt:XPathContext

The XPath context.

Returns:XObject

the right XObject based on the type of the object passed.

deepEqualsback to summary
public boolean deepEquals(Expression expr)

Implements abstract com.sun.org.apache.xpath.internal.Expression.deepEquals.

Doc from com.sun.org.apache.xpath.internal.Expression.deepEquals.

Compare this object with another object and see if they are equal, include the sub heararchy.

See Also
Expression#deepEquals(Expression)
destructback to summary
public void destruct()

Forces the object to release it's resources. This is more harsh than detach().

detachback to summary
public void detach()

Detaches the DTMIterator from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state. After detach has been invoked, calls to nextNode or previousNode will raise a runtime exception.

dispatchCharactersEventsback to summary
public void dispatchCharactersEvents(ContentHandler ch) throws SAXException

Directly call the characters method on the passed ContentHandler for the string-value. Multiple calls to the ContentHandler's characters methods may well occur for a single call to this method.

Parameters
ch:ContentHandler

A non-null reference to a ContentHandler.

equalsback to summary
public boolean equals(XObject obj2)

Tell if two objects are functionally equal.

Parameters
obj2:XObject

Object to compare this to

Returns:boolean

True if this object is equal to the given object

errorback to summary
protected void error(String msg) throws TransformerException

Tell the user of an error, and probably throw an exception.

Parameters
msg:String

Error message to issue

errorback to summary
protected void error(String msg, Object[] args) throws TransformerException

Tell the user of an error, and probably throw an exception.

Parameters
msg:String

Error message to issue

args:Object[]

Arguments to use in the message

executeback to summary
public XObject execute(XPathContext xctxt) throws TransformerException

Implements abstract com.sun.org.apache.xpath.internal.Expression.execute.

For support of literal objects in xpaths.

Parameters
xctxt:XPathContext

The XPath execution context.

Returns:XObject

This object.

Exceptions
TransformerException:

Doc from com.sun.org.apache.xpath.internal.Expression.execute.

if a runtime exception occurs.

fixupVariablesback to summary
public void fixupVariables(List<QName> vars, int globalsSize)

Implements abstract com.sun.org.apache.xpath.internal.Expression.fixupVariables.

XObjects should not normally need to fix up variables.

getFreshback to summary
public XObject getFresh()

Get a fresh copy of the object. For use with variables.

Returns:XObject

This object, unless overridden by subclass.

getTypeback to summary
public int getType()

Tell what kind of class this is.

Returns:int

CLASS_UNKNOWN

getTypeStringback to summary
public String getTypeString()

Given a request type, return the equivalent string. For diagnostic purposes.

Returns:String

type string "#UNKNOWN" + object class name

greaterThanback to summary
public boolean greaterThan(XObject obj2) throws TransformerException

Tell if one object is greater than the other.

Parameters
obj2:XObject

Object to compare this to

Returns:boolean

True if this object is greater than the given object

greaterThanOrEqualback to summary
public boolean greaterThanOrEqual(XObject obj2) throws TransformerException

Tell if one object is greater than or equal to the other.

Parameters
obj2:XObject

Object to compare this to

Returns:boolean

True if this object is greater than or equal to the given object

iterback to summary
public DTMIterator iter() throws TransformerException

Cast result object to a nodelist. Always issues an error.

Returns:DTMIterator

null

lessThanback to summary
public boolean lessThan(XObject obj2) throws TransformerException

Tell if one object is less than the other.

Parameters
obj2:XObject

Object to compare this to

Returns:boolean

True if this object is less than the given object

lessThanOrEqualback to summary
public boolean lessThanOrEqual(XObject obj2) throws TransformerException

Tell if one object is less than or equal to the other.

Parameters
obj2:XObject

Object to compare this to

Returns:boolean

True if this object is less than or equal to the given object

mutableNodesetback to summary
public NodeSetDTM mutableNodeset() throws TransformerException

Cast result object to a nodelist. Always issues an error.

Returns:NodeSetDTM

The object as a NodeSetDTM.

nodelistback to summary
public NodeList nodelist() throws TransformerException

Cast result object to a nodelist. Always issues an error.

Returns:NodeList

null

nodesetback to summary
public NodeIterator nodeset() throws TransformerException

Cast result object to a nodelist. Always issues an error.

Returns:NodeIterator

null

notEqualsback to summary
public boolean notEquals(XObject obj2) throws TransformerException

Tell if two objects are functionally not equal.

Parameters
obj2:XObject

Object to compare this to

Returns:boolean

True if this object is not equal to the given object

numback to summary
public double num() throws TransformerException

Cast result object to a number. Always issues an error.

Returns:double

0.0

numWithSideEffectsback to summary
public double numWithSideEffects() throws TransformerException

Cast result object to a number, but allow side effects, such as the incrementing of an iterator.

Returns:double

numeric value of the string conversion from the next node in the NodeSetDTM, or NAN if no node was found

objectback to summary
public Object object()

Return a java object that's closest to the representation that should be handed to an extension.

Returns:Object

The object that this class wraps

resetback to summary
public void reset()

Reset for fresh reuse.

rtfback to summary
public int rtf(XPathContext support)

Cast result object to a result tree fragment.

Parameters
support:XPathContext

XPath context to use for the conversion

Returns:int

the objec as a result tree fragment.

rtfback to summary
public int rtf()

For functions to override.

Returns:int

null

rtreeback to summary
public DocumentFragment rtree(XPathContext support)

Cast result object to a result tree fragment.

Parameters
support:XPathContext

XPath context to use for the conversion

Returns:DocumentFragment

the objec as a result tree fragment.

rtreeback to summary
public DocumentFragment rtree()

For functions to override.

Returns:DocumentFragment

null

setObjectback to summary
protected void setObject(Object obj)
strback to summary
public String str()

Cast result object to a string.

Returns:String

The object as a string

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Return the string representation of the object

Returns:String

the string representation of the object

xstrback to summary
public XMLString xstr()

Cast result object to a string.

Returns:XMLString

The string this wraps or the empty string if null