Class XStreamUtils

java.lang.Object
org.codehaus.groovy.control.XStreamUtils

public abstract class XStreamUtils extends Object
Serializes AST structures to XML for debugging.
  • Constructor Details

    • XStreamUtils

      public XStreamUtils()
  • Method Details

    • toXML

      public static String toXML(Object ast)
      Serializes ast to XML. This is the in-memory form of groovy.ast=xml; serialize(String, Object) writes the same document next to the source.
      Parameters:
      ast - the AST object to serialize
      Returns:
      the XStream XML document
    • toXML

      public static void toXML(Object ast, Writer writer)
      Serializes ast to XML on writer.
      Parameters:
      ast - the AST object to serialize
      writer - the destination
    • serialize

      public static void serialize(String name, Object ast)
      Serializes the supplied AST object to an XML file next to the named source. The file is given the source file's permissions, so it exposes no more than the source already does; where there is no source file to match, or the filesystem has no POSIX permissions, the file is owner-only or left to the default respectively.
      Parameters:
      name - the source name or URI used to derive the XML file name
      ast - the AST object to serialize