Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.xpath.objects
Class XObject  view XObject download XObject.java

java.lang.Object
  extended byorg.apache.xpath.Expression
      extended byorg.apache.xpath.objects.XObject
All Implemented Interfaces:
java.lang.Cloneable, org.apache.xpath.ExpressionNode, java.io.Serializable, javax.xml.transform.SourceLocator, org.apache.xpath.XPathVisitable
Direct Known Subclasses:
org.apache.xpath.axes.NodeSequence, XBoolean, XNumber, XRTreeFrag, XString

public class XObject
extends org.apache.xpath.Expression
implements java.io.Serializable, java.lang.Cloneable

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
static int CLASS_BOOLEAN
          Constant for BOOLEAN object type
static int CLASS_NODESET
          Constant for NODESET object type
static int CLASS_NULL
          Constant for NULL object type
static int CLASS_NUMBER
          Constant for NUMBER object type
static int CLASS_RTREEFRAG
          Constant for RESULT TREE FRAGMENT object type
static int CLASS_STRING
          Constant for STRING object type
static int CLASS_UNKNOWN
          Constant for UNKNOWN object type
static int CLASS_UNRESOLVEDVARIABLE
          Represents an unresolved variable type as an integer.
protected  java.lang.Object m_obj
          The java object which this object wraps.
 
Fields inherited from class org.apache.xpath.Expression
 
Constructor Summary
XObject()
          Create an XObject.
XObject(java.lang.Object obj)
          Create an XObject.
 
Method Summary
 void allowDetachToRelease(boolean allowRelease)
          Specify if it's OK for detach to release the iterator for reuse.
 void appendToFsb(org.apache.xml.utils.FastStringBuffer fsb)
          Cast result object to a string.
 boolean bool()
          Cast result object to a boolean.
 boolean boolWithSideEffects()
          Cast result object to a boolean, but allow side effects, such as the incrementing of an iterator.
 void callVisitors(org.apache.xpath.ExpressionOwner owner, org.apache.xpath.XPathVisitor visitor)
          This will traverse the heararchy, calling the visitor for each member.
 java.lang.Object castToType(int t, org.apache.xpath.XPathContext support)
          Cast object to type t.
static XObject create(java.lang.Object val)
          Create the right XObject based on the type of the object passed.
static XObject create(java.lang.Object val, org.apache.xpath.XPathContext xctxt)
          Create the right XObject based on the type of the object passed.
 boolean deepEquals(org.apache.xpath.Expression expr)
          Compare this object with another object and see if they are equal, include the sub heararchy.
 void destruct()
          Forces the object to release it's resources.
 void detach()
          Detaches the DTMIterator from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state.
 void dispatchCharactersEvents(org.xml.sax.ContentHandler ch)
          Directly call the characters method on the passed ContentHandler for the string-value.
 boolean equals(XObject obj2)
          Tell if two objects are functionally equal.
protected  void error(java.lang.String msg)
          Tell the user of an error, and probably throw an exception.
protected  void error(java.lang.String msg, java.lang.Object[] args)
          Tell the user of an error, and probably throw an exception.
 XObject execute(org.apache.xpath.XPathContext xctxt)
          For support of literal objects in xpaths.
 void fixupVariables(java.util.Vector vars, int globalsSize)
          XObjects should not normally need to fix up variables.
 XObject getFresh()
          Get a fresh copy of the object.
 int getType()
          Tell what kind of class this is.
 java.lang.String getTypeString()
          Given a request type, return the equivalent string.
 boolean greaterThan(XObject obj2)
          Tell if one object is greater than the other.
 boolean greaterThanOrEqual(XObject obj2)
          Tell if one object is greater than or equal to the other.
 org.apache.xml.dtm.DTMIterator iter()
          Cast result object to a nodelist.
 boolean lessThan(XObject obj2)
          Tell if one object is less than the other.
 boolean lessThanOrEqual(XObject obj2)
          Tell if one object is less than or equal to the other.
 org.apache.xpath.NodeSetDTM mutableNodeset()
          Cast result object to a nodelist.
 org.w3c.dom.NodeList nodelist()
          Cast result object to a nodelist.
 org.w3c.dom.traversal.NodeIterator nodeset()
          Cast result object to a nodelist.
 boolean notEquals(XObject obj2)
          Tell if two objects are functionally not equal.
 double num()
          Cast result object to a number.
 double numWithSideEffects()
          Cast result object to a number, but allow side effects, such as the incrementing of an iterator.
 java.lang.Object object()
          Return a java object that's closest to the representation that should be handed to an extension.
 void reset()
          Reset for fresh reuse.
 int rtf()
          For functions to override.
 int rtf(org.apache.xpath.XPathContext support)
          Cast result object to a result tree fragment.
 org.w3c.dom.DocumentFragment rtree()
          For functions to override.
 org.w3c.dom.DocumentFragment rtree(org.apache.xpath.XPathContext support)
          Cast result object to a result tree fragment.
 java.lang.String str()
          Cast result object to a string.
 java.lang.String toString()
          Return the string representation of the object
 org.apache.xml.utils.XMLString xstr()
          Cast result object to a string.
 
Methods inherited from class org.apache.xpath.Expression
asIterator, asIteratorRaw, asNode, assertion, bool, canTraverseOutsideSubtree, error, execute, execute, execute, executeCharsToContentHandler, exprAddChild, exprGetChild, exprGetNumChildren, exprGetParent, exprSetParent, getColumnNumber, getExpressionOwner, getLineNumber, getPublicId, getSystemId, isNodesetExpr, isSameClass, isStableNumber, num, warn, xstr
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_obj

protected java.lang.Object m_obj
The java object which this object wraps.


CLASS_NULL

public static final int CLASS_NULL
Constant for NULL object type

See Also:
Constant Field Values

CLASS_UNKNOWN

public static final int CLASS_UNKNOWN
Constant for UNKNOWN object type

See Also:
Constant Field Values

CLASS_BOOLEAN

public static final int CLASS_BOOLEAN
Constant for BOOLEAN object type

See Also:
Constant Field Values

CLASS_NUMBER

public static final int CLASS_NUMBER
Constant for NUMBER object type

See Also:
Constant Field Values

CLASS_STRING

public static final int CLASS_STRING
Constant for STRING object type

See Also:
Constant Field Values

CLASS_NODESET

public static final int CLASS_NODESET
Constant for NODESET object type

See Also:
Constant Field Values

CLASS_RTREEFRAG

public static final int CLASS_RTREEFRAG
Constant for RESULT TREE FRAGMENT object type

See Also:
Constant Field Values

CLASS_UNRESOLVEDVARIABLE

public static final int CLASS_UNRESOLVEDVARIABLE
Represents an unresolved variable type as an integer.

See Also:
Constant Field Values
Constructor Detail

XObject

public XObject()
Create an XObject.


XObject

public XObject(java.lang.Object obj)
Create an XObject.

Method Detail

execute

public XObject execute(org.apache.xpath.XPathContext xctxt)
                throws javax.xml.transform.TransformerException
For support of literal objects in xpaths.


allowDetachToRelease

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.


detach

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.


destruct

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


reset

public void reset()
Reset for fresh reuse.


dispatchCharactersEvents

public void dispatchCharactersEvents(org.xml.sax.ContentHandler ch)
                              throws org.xml.sax.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.


create

public static XObject create(java.lang.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.


create

public static XObject create(java.lang.Object val,
                             org.apache.xpath.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.


getType

public int getType()
Tell what kind of class this is.


getTypeString

public java.lang.String getTypeString()
Given a request type, return the equivalent string. For diagnostic purposes.


num

public double num()
           throws javax.xml.transform.TransformerException
Cast result object to a number. Always issues an error.


numWithSideEffects

public double numWithSideEffects()
                          throws javax.xml.transform.TransformerException
Cast result object to a number, but allow side effects, such as the incrementing of an iterator.


bool

public boolean bool()
             throws javax.xml.transform.TransformerException
Cast result object to a boolean. Always issues an error.


boolWithSideEffects

public boolean boolWithSideEffects()
                            throws javax.xml.transform.TransformerException
Cast result object to a boolean, but allow side effects, such as the incrementing of an iterator.


xstr

public org.apache.xml.utils.XMLString xstr()
Cast result object to a string.


str

public java.lang.String str()
Cast result object to a string.


toString

public java.lang.String toString()
Return the string representation of the object


rtf

public int rtf(org.apache.xpath.XPathContext support)
Cast result object to a result tree fragment.


rtree

public org.w3c.dom.DocumentFragment rtree(org.apache.xpath.XPathContext support)
Cast result object to a result tree fragment.


rtree

public org.w3c.dom.DocumentFragment rtree()
For functions to override.


rtf

public int rtf()
For functions to override.


object

public java.lang.Object object()
Return a java object that's closest to the representation that should be handed to an extension.


iter

public org.apache.xml.dtm.DTMIterator iter()
                                    throws javax.xml.transform.TransformerException
Cast result object to a nodelist. Always issues an error.


getFresh

public XObject getFresh()
Get a fresh copy of the object. For use with variables.


nodeset

public org.w3c.dom.traversal.NodeIterator nodeset()
                                           throws javax.xml.transform.TransformerException
Cast result object to a nodelist. Always issues an error.


nodelist

public org.w3c.dom.NodeList nodelist()
                              throws javax.xml.transform.TransformerException
Cast result object to a nodelist. Always issues an error.


mutableNodeset

public org.apache.xpath.NodeSetDTM mutableNodeset()
                                           throws javax.xml.transform.TransformerException
Cast result object to a nodelist. Always issues an error.


castToType

public java.lang.Object castToType(int t,
                                   org.apache.xpath.XPathContext support)
                            throws javax.xml.transform.TransformerException
Cast object to type t.


lessThan

public boolean lessThan(XObject obj2)
                 throws javax.xml.transform.TransformerException
Tell if one object is less than the other.


lessThanOrEqual

public boolean lessThanOrEqual(XObject obj2)
                        throws javax.xml.transform.TransformerException
Tell if one object is less than or equal to the other.


greaterThan

public boolean greaterThan(XObject obj2)
                    throws javax.xml.transform.TransformerException
Tell if one object is greater than the other.


greaterThanOrEqual

public boolean greaterThanOrEqual(XObject obj2)
                           throws javax.xml.transform.TransformerException
Tell if one object is greater than or equal to the other.


equals

public boolean equals(XObject obj2)
Tell if two objects are functionally equal.


notEquals

public boolean notEquals(XObject obj2)
                  throws javax.xml.transform.TransformerException
Tell if two objects are functionally not equal.


error

protected void error(java.lang.String msg)
              throws javax.xml.transform.TransformerException
Tell the user of an error, and probably throw an exception.


error

protected void error(java.lang.String msg,
                     java.lang.Object[] args)
              throws javax.xml.transform.TransformerException
Tell the user of an error, and probably throw an exception.


fixupVariables

public void fixupVariables(java.util.Vector vars,
                           int globalsSize)
XObjects should not normally need to fix up variables.


appendToFsb

public void appendToFsb(org.apache.xml.utils.FastStringBuffer fsb)
Cast result object to a string. NEEDSDOC @param fsb


callVisitors

public void callVisitors(org.apache.xpath.ExpressionOwner owner,
                         org.apache.xpath.XPathVisitor visitor)
Description copied from interface: org.apache.xpath.XPathVisitable
This will traverse the heararchy, calling the visitor for each member. If the called visitor method returns false, the subtree should not be called.

Specified by:
callVisitors in interface org.apache.xpath.XPathVisitable

deepEquals

public boolean deepEquals(org.apache.xpath.Expression expr)
Description copied from class: org.apache.xpath.Expression
Compare this object with another object and see if they are equal, include the sub heararchy.