UnmarshalledObject.java :  » XML » zeus » org » enhydra » zeus » Java Open Source

Java Open Source » XML » zeus 
zeus » org » enhydra » zeus » UnmarshalledObject.java
/*
 * Enhydra Java Application Server Project
 * 
 * The contents of this file are subject to the Enhydra Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License on
 * the Enhydra web site ( http://www.enhydra.org/ ).
 * 
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 
 * the License for the specific terms governing rights and limitations
 * under the License.
 * 
 * The Initial Developer of the Enhydra Application Server is Lutris
 * Technologies, Inc. The Enhydra Application Server and portions created
 * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
 * All Rights Reserved.
 */
package org.enhydra.zeus;

/**
 * <p>
 *  <code>UnmarshalledObject</code> represents an object that has been
 *    unmarshalled by Zeus. It allows access to the original document's
 *    system and public IDs for use in marshalling.
 * </p>
 *
 * @author Brett McLaughlin
 * @author Maciej Zawadzki
 */
public class UnmarshalledObject {

    /** The object that was unmarshalled */
    protected Object object;

    /** The system ID of the original XML document */
    protected String systemID;
    
    /** The public ID of the original XML document */
    protected String publicID;
    
    /**
     * <p>
     *  A simple contructor that accepts the object, system ID, 
     *    and public ID as parameters.
     * </p>
     *
     * @param object the Object graph representing an XML document
     * @param systemID the system ID of the DTD to which the 
     *        XML document must conform
     * @param publicID the public ID of the DTD to which the 
     *        XML document must conform
     */
    public UnmarshalledObject(Object object, String publicID, String systemID) {
        // Error checking
        if (object == null) {
            throw new IllegalArgumentException("An UnmarshalledObject cannot " +
                "have a null internal Object reference.");
        }
        
        this.object =  object;
        this.systemID = systemID;
        this.publicID = publicID;
    }

    /**
     * <p>
     *  This creates a new instance of an unmarshalled object,
     *    with no system or public ID.
     * </p>
     *
     * @param object the Object graph representing an XML document
     */
    public UnmarshalledObject(Object object) {
        this(object, null, null);
    }

    /**
     * <p>
     *  This returns the object graph that represents an XML document.
     * </p>
     *
     * @return <code>Object</code> graph representing an XML document
     */
    public Object getObject() {
        return object;
    }
    
    /**
     * <p>
     *  Returns the system ID of the DTD to which the 
     *    XML document representation of the content must conform.  
     * </p>
     *
     * @return <code>String</code> system ID of the DTD to which 
     *         the XML document representation of the content must conform.
     */
    public String getSystemID() {
        return systemID;
    }
    
    /**
     * <p>
     *  Returns the public ID of the DTD to which the 
     *    XML document representation of the content must conform.  
     * </p>
     *
     * @return <code>String</code> public ID of the DTD to which 
     *         the XML document representation of the content must conform.
     */
    public String getPublicID() {
        return publicID;
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.