package org.biomoby.shared.data;

/**
 * A convenience interface for passing arrays of instance data around without
 * needing to type cast.
 */

public interface MobyDataInstance{

    public static final int CENTRAL_XML_MODE = 124;
    public static final int SERVICE_XML_MODE = 891;

    /**
     * Returns the MOBY XML representation of the object.
     */
    public String toXML();

    /**
     * Determined whether toXML will return a Central template value or a service call instance value.
     *
     * @param mode one of CENTRAL_XML_MODE or SERVICE_XML_MODE
     * @throws IllegalArgumentException if the mode is not one of the specified values
     */
    public void setXmlMode(int mode) throws IllegalArgumentException;

    /**
     * Report whether toXML will produce Central template or service call instance XML.
     *
     * @return one of CENTRAL_XML_MODE or SERVICE_XML_MODE
     */
    public int getXmlMode();

    /**
     * Each implementer will return the underlying Java object used to store the MOBY value.
     * For example, MOBY Floats are stored internally as BigDecimal objects.
     */
    public Object getObject();

    /**
     * Retrieves any application-specific data that may have been stored in association with this Moby object.
     * The returned object has nothing to do with the Moby protocol itself.  See setUserData() for more details.
     */
    public Object getUserData();

    /**
     * Allows developers to track their application-specific information alongside the Moby functionality.
     * Provided for application developers' convenience: data stored using this routine is completely 
     * ignore by the Moby core libraries.  If you want to store Moby data, use the routines defined in various
     * subclasses of this class (e.g. MobyDataObject).
     */
    public void setUserData(Object data);

    public void setName(String name);
    public String getName();
}
