Class XmlConstraintSaver


  • public final class XmlConstraintSaver
    extends java.lang.Object
    The XmlConstraintSaver class provides functionality to save a constraint with all its attributes to an XML file.
    • Constructor Summary

      Constructors 
      Constructor Description
      XmlConstraintSaver​(Constraint constraint)
      Constructs an XMLConstraintSaver object that saves the specified constraint to the specified XML document.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void save​(java.io.OutputStream output)
      Saves the constraint object to an OutputStream.
      void saveToFile​(java.lang.String fileName)
      Saves the constraint object to an XML file.
      java.lang.String saveToString()
      Saves the constraint object to an XML string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XmlConstraintSaver

        public XmlConstraintSaver​(Constraint constraint)
        Constructs an XMLConstraintSaver object that saves the specified constraint to the specified XML document.
        Parameters:
        constraint - Constraint to be save.
        Throws:
        java.lang.IllegalArgumentException - if the parameter equals null; if the constraint is not formula-based (its type is not FORMULA_BASED). Currently, the possibility of saving other constraint types is not implemented.
    • Method Detail

      • saveToString

        public java.lang.String saveToString()
                                      throws XmlNotSavedException
        Saves the constraint object to an XML string.
        Returns:
        XML text for the constraint.
        Throws:
        XmlNotSavedException - if failed to save the constraint to a string.
      • saveToFile

        public void saveToFile​(java.lang.String fileName)
                        throws XmlNotSavedException
        Saves the constraint object to an XML file.
        Parameters:
        fileName - Target XML document file name.
        Throws:
        java.lang.IllegalArgumentException - if the parameter equals null.
        XmlNotSavedException - if failed to save the constraint to a file.
      • save

        public void save​(java.io.OutputStream output)
                  throws XmlNotSavedException
        Saves the constraint object to an OutputStream.
        Parameters:
        output - OutputStream to store constraint.
        Throws:
        java.lang.IllegalArgumentException - if the parameter equals null.
        XmlNotSavedException - if failed to save the constraint to a file.