Interface MoMLExportable

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String exportMoML()
      Return a MoML description of this object.
      void exportMoML​(java.io.Writer output)
      Write a MoML description of this object using the specified Writer.
      void exportMoML​(java.io.Writer output, int depth)
      Write a MoML description of this entity with the specified depth in a hierarchy.
      void exportMoML​(java.io.Writer output, int depth, java.lang.String name)
      Write a MoML description of this entity with the specified depth in a hierarchy and with the specified name substituting for the name of this object.
      java.lang.String exportMoML​(java.lang.String name)
      Return a MoML description of this object with its name replaced by the specified name.
      java.lang.String getClassName()
      Return the class name.
      java.lang.String getElementName()
      Get the XML element name.
      java.lang.String getSource()
      Get the source, which gives an external URL associated with an entity (presumably from which the entity was defined).
      boolean isPersistent()
      Return true if this object is persistent.
      void setPersistent​(boolean isPersistent)
      Set the persistence of this object.
      void setSource​(java.lang.String source)
      Set the source, which gives an external URL associated with an entity (presumably from which the entity was defined).
    • Method Detail

      • exportMoML

        java.lang.String exportMoML()
        Return a MoML description of this object. This might be an empty string if there is no MoML description of this object or if this object is not persistent or if an implementor has some other reason that the object has no persistent description.
        Returns:
        A MoML description, or an empty string if there is none.
        See Also:
        isPersistent()
      • exportMoML

        java.lang.String exportMoML​(java.lang.String name)
        Return a MoML description of this object with its name replaced by the specified name. The description might be an empty string if there is no MoML description of this object or if this object is not persistent, or if an implementor has some other reason that the object has no persistent description.
        Parameters:
        name - The name that is used as a replacement.
        Returns:
        A MoML description, or the empty string if there is none.
        See Also:
        isPersistent()
      • exportMoML

        void exportMoML​(java.io.Writer output)
                 throws java.io.IOException
        Write a MoML description of this object using the specified Writer. If there is no MoML description, or if the object is not persistent, or if an implementor has some other reason that the object has no persistent description, then nothing is written. To write to standard out, do
              exportMoML(new OutputStreamWriter(System.out))
          
        Parameters:
        output - The writer to write to.
        Throws:
        java.io.IOException - If an I/O error occurs.
        See Also:
        isPersistent()
      • exportMoML

        void exportMoML​(java.io.Writer output,
                        int depth)
                 throws java.io.IOException
        Write a MoML description of this entity with the specified depth in a hierarchy. The depth in the hierarchy determines indenting of the output, but may also be used to indicate to an implementor whether this object is being exported as part of the export of its container (in which case depth > 0), or this object is being exported independently of its container (depth == 0). If there is no MoML description, or if the object is not persistent, or if an implementor has some other reason that the object has no persistent description, then nothing is written.
        Parameters:
        output - The output writer to write to.
        depth - The depth in the hierarchy.
        Throws:
        java.io.IOException - If an I/O error occurs.
        See Also:
        isPersistent()
      • exportMoML

        void exportMoML​(java.io.Writer output,
                        int depth,
                        java.lang.String name)
                 throws java.io.IOException
        Write a MoML description of this entity with the specified depth in a hierarchy and with the specified name substituting for the name of this object. The depth in the hierarchy determines indenting of the output, but may also be used to indicate to an implementor whether this object is being exported as part of the export of its container (in which case depth > 0), or this object is being exported independently of its container (depth == 0). If there is no MoML description, or if the object is not persistent, or if an implementor has some other reason that the object has no persistent description, then nothing is written.
        Parameters:
        output - The output writer to write to.
        depth - The depth in the hierarchy, to determine indenting.
        name - The name to use in the exported MoML.
        Throws:
        java.io.IOException - If an I/O error occurs.
        See Also:
        isPersistent()
      • getClassName

        java.lang.String getClassName()
        Return the class name. This is either the name of the class of which this object is an instance, or if this object is itself a class, then the class that it extends. The class name could be a fully qualified Java class name or the name of the parent of this object if it has a parent.
        Returns:
        The MoML class name.
        See Also:
        Instantiable.getParent()
      • getElementName

        java.lang.String getElementName()
        Get the XML element name. Implementors should provide the appropriate XML element name to use when exporting MoML.
        Returns:
        The XML element name for this object.
      • getSource

        java.lang.String getSource()
        Get the source, which gives an external URL associated with an entity (presumably from which the entity was defined). This becomes the value in the "source" attribute of exported MoML.
        Returns:
        The source, or null if there is none.
        See Also:
        setSource(String)
      • isPersistent

        boolean isPersistent()
        Return true if this object is persistent. A persistent object has a MoML description that can be stored in a file and used to re-create the object. A non-persistent object has an empty MoML description.
        Returns:
        True if the object is persistent.
        See Also:
        setPersistent(boolean)
      • setPersistent

        void setPersistent​(boolean isPersistent)
        Set the persistence of this object. If the persistence is not specified with this method, then by default the object will be persistent unless it is derivable by derivation from a class. A persistent object has a non-empty MoML description that can be used to re-create the object. To make an instance non-persistent, call this method with the argument false. To force it to always be persistent, irrespective of its relationship to a class, then call this with argument true. Note that this will have the additional effect that it no longer inherits properties from the class, so in effect, calling this with true overrides values given by the class.
        Parameters:
        isPersistent - False to make this object non-persistent.
        See Also:
        isPersistent()
      • setSource

        void setSource​(java.lang.String source)
        Set the source, which gives an external URL associated with an entity (presumably from which the entity was defined). This becomes the value in the "source" attribute of exported MoML. Call this with null to prevent any source attribute from being generated.
        Parameters:
        source - The source, or null if there is none.
        See Also:
        getSource()