package com.dbxml.db.common.xupdate;

/*
 * dbXML - Native XML Database
 * Copyright (C) 1999-2004  The dbXML Group, L.L.C.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * $Id: XObjectImpl.java,v 1.3 2004/07/29 12:26:47 bradford Exp $
 */

import org.apache.xpath.objects.XObject;
import org.w3c.dom.DocumentFragment;
import org.w3c.dom.NodeList;

/**
 * Wrapper for Xalan XObject
 */

public final class XObjectImpl implements org.xmldb.common.xml.queries.XObject {

   private XObject _xobj;

   /**
    * Creates a new XObject to wrap a Xalan XObject
    *
    * @param xobj xalan's XObject that should be wrapped.
    * @exception IllegalArgumentException If the given XObject was null.
    */
   public XObjectImpl(XObject xobj) throws IllegalArgumentException {
      if ( xobj == null )
         throw new IllegalArgumentException("XalanXObject(): Argument was null!");
      _xobj = xobj;
   }

   public int getType() {
      return _xobj.getType();
   }

   public boolean bool() throws Exception {
      return _xobj.bool();
   }

   public double num() throws Exception {
      return _xobj.num();
   }

   public String str() {
      return _xobj.str();
   }

   public NodeList nodeset() throws Exception {
      return _xobj.nodelist();
   }

   public DocumentFragment rtree() {
      return _xobj.rtree();
   }
}
