BEA Systems, Inc.

WebLogic Server 6.1 API Reference

weblogic.apache.xpath.objects
Class XObject

java.lang.Object
  |
  +--weblogic.apache.xpath.Expression
        |
        +--weblogic.apache.xpath.objects.XObject
Direct Known Subclasses:
XBoolean, XNodeSet, XNull, XNumber, XObject, XRTreeFrag, XString, XUnresolvedVariable

public class XObject
extends Expression
implements java.io.Serializable

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.

This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.

See Also:
Serialized Form

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 weblogic.apache.xpath.Expression
m_slocator
 
Constructor Summary
XObject()
          Create an XObject.
XObject(java.lang.Object obj)
          Create an XObject.
 
Method Summary
 boolean bool()
          Cast result object to a boolean.
 java.lang.Object castToType(int t, 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.
 boolean equals(XObject obj2)
          Tell if two objects are functionally equal.
protected  void error(int msg)
          Tell the user of an error, and probably throw an exception.
protected  void error(int msg, java.lang.Object[] args)
          Tell the user of an error, and probably throw an exception.
 XObject execute(XPathContext xctxt)
          For support of literal objects in xpaths.
 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.
 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.
 NodeSet mutableNodeset()
          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.
 java.lang.Object object()
          Return a java object that's closest to the representation that should be handed to an extension.
 org.w3c.dom.DocumentFragment rtree()
          For functions to override.
 org.w3c.dom.DocumentFragment rtree(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
 
Methods inherited from class weblogic.apache.xpath.Expression
assert, canTraverseOutsideSubtree, error, setSourceLocator, warn
 
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

CLASS_UNKNOWN

public static final int CLASS_UNKNOWN
Constant for UNKNOWN object type

CLASS_BOOLEAN

public static final int CLASS_BOOLEAN
Constant for BOOLEAN object type

CLASS_NUMBER

public static final int CLASS_NUMBER
Constant for NUMBER object type

CLASS_STRING

public static final int CLASS_STRING
Constant for STRING object type

CLASS_NODESET

public static final int CLASS_NODESET
Constant for NODESET object type

CLASS_RTREEFRAG

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

CLASS_UNRESOLVEDVARIABLE

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

XObject

public XObject()
Create an XObject.

XObject

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

Parameters:
obj - Can be any object, should be a specific type for derived classes, or null.
Method Detail

execute

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

Parameters:
xctxt - The XPath execution context.
Returns:
This object.
Throws:
javax.xml.transform.TransformerException -  
Overrides:
execute in class Expression

create

public static XObject create(java.lang.Object val)
Create the right XObject based on the type of the object passed.

Parameters:
val - The java object which this object will wrap.
Returns:
the right XObject based on the type of the object passed.

getType

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

Returns:
CLASS_UNKNOWN

getTypeString

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

Returns:
type string "#UNKNOWN" + object class name

num

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

Returns:
0.0
Throws:
javax.xml.transform.TransformerException -  

bool

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

Returns:
false
Throws:
javax.xml.transform.TransformerException -  

str

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

Returns:
The object as a string

toString

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

Returns:
the string representation of the object
Overrides:
toString in class java.lang.Object

rtree

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

Parameters:
support - XPath context to use for the conversion
Returns:
the objec as a result tree fragment.

rtree

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

Returns:
null

object

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

Returns:
The object that this class wraps

nodeset

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

Returns:
null
Throws:
javax.xml.transform.TransformerException -  

mutableNodeset

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

Returns:
The object as a NodeSet.
Throws:
javax.xml.transform.TransformerException -  

castToType

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

Parameters:
t - Type of object to cast this to
support - XPath context to use for the conversion
Returns:
This object as the given type t
Throws:
javax.xml.transform.TransformerException -  

lessThan

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

Parameters:
obj2 - Object to compare this to
Returns:
True if this object is less than the given object
Throws:
javax.xml.transform.TransformerException -  

lessThanOrEqual

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

Parameters:
obj2 - Object to compare this to
Returns:
True if this object is less than or equal to the given object
Throws:
javax.xml.transform.TransformerException -  

greaterThan

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

Parameters:
obj2 - Object to compare this to
Returns:
True if this object is greater than the given object
Throws:
javax.xml.transform.TransformerException -  

greaterThanOrEqual

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

Parameters:
obj2 - Object to compare this to
Returns:
True if this object is greater than or equal to the given object
Throws:
javax.xml.transform.TransformerException -  

equals

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

Parameters:
obj2 - Object to compare this to
Returns:
True if this object is equal to the given object
Throws:
javax.xml.transform.TransformerException -  

notEquals

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

Parameters:
obj2 - Object to compare this to
Returns:
True if this object is not equal to the given object
Throws:
javax.xml.transform.TransformerException -  

error

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

Parameters:
msg - Error message to issue
Throws:
javax.xml.transform.TransformerException -  

error

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

Parameters:
msg - Error message to issue
args - Arguments to use in the message
Throws:
javax.xml.transform.TransformerException -  

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs61

WebLogic classes and methods that do not appear in this reference are not public and are not supported.