code: public Object castToType(int t, XPathContext support)
            throws javax.xml.transform.TransformerException
    {
  
      Object result;
  
      switch (t)
      {
      case CLASS_STRING :
        result = str();
        break;
      case CLASS_NUMBER :
        result = new Double(num());
        break;
      case CLASS_NODESET :
        result = iter();
        break;
      case CLASS_BOOLEAN :
        result = new Boolean(bool());
        break;
      case CLASS_UNKNOWN :
        result = m_obj;
        break;
  
      // %TBD%  What to do here?
      //    case CLASS_RTREEFRAG :
      //      result = rtree(support);
      //      break;
      default :
        error(XPATHErrorResources.ER_CANT_CONVERT_TO_TYPE,
              new Object[]{ getTypeString(),
                            Integer.toString(t) });  //"Can not convert "+getTypeString()+" to a type#"+t);
  
        result = null;
      }
  
      return result;
    }
docs: Cast object to type t.
  
  @param t Type of object to cast this to
  @param support XPath context to use for the conversion
  
  @return This object as the given type t
  
  @throws javax.xml.transform.TransformerException