Class XMLContextBuilder

  • All Implemented Interfaces:
    ContextBuilder

    public class XMLContextBuilder
    extends Object
    implements ContextBuilder
    ContextBuilder that loads context from a xml serialized file.
    Author:
    Nick Collier
    • Constructor Detail

      • XMLContextBuilder

        public XMLContextBuilder​(String fileName)
        Creates an XMLContext builder that will load from the named file.
        Parameters:
        fileName - the name of the file to load from
      • XMLContextBuilder

        public XMLContextBuilder​(String fileName,
                                 List<com.thoughtworks.xstream.converters.Converter> converters)
        Creates an XMLContext builder that will load from the named file.
        Parameters:
        fileName - the name of the file to load from
        converters - a list of XStream Converters to register and use in the XML conversion.
      • XMLContextBuilder

        public XMLContextBuilder​(File xmlFile,
                                 List<com.thoughtworks.xstream.converters.Converter> converters)
        Creates an XMLContext builder that will load from the named file.
        Parameters:
        xmlFile - the file to load from
        converters - a list of XStream Converters to register and use in the XML conversion.
      • XMLContextBuilder

        public XMLContextBuilder​(File xmlFile)
        Creates an XMLContext builder that will load the specified file
        Parameters:
        xmlFile - the file to load from
    • Method Detail

      • build

        public Context build​(Context context)
        Builds and returns a context. Building a context consists of filling it with agents, adding projects and so forth. The returned context does not necessarily have to be the passed in context.
        Specified by:
        build in interface ContextBuilder
        Parameters:
        context - a default context
        Returns:
        the built context.
      • getXMLFile

        public File getXMLFile()
        Gets the serialized xml file from which this builder loads a context.
        Returns:
        the serialized xml file from which this builder loads a context.