Class TemplateQueryBinding


  • public class TemplateQueryBinding
    extends PathQueryBinding
    Convert PathQueries to and from XML
    Author:
    Mark Woodbridge
    • Constructor Detail

      • TemplateQueryBinding

        public TemplateQueryBinding()
    • Method Detail

      • marshal

        public static void marshal​(TemplateQuery template,
                                   javax.xml.stream.XMLStreamWriter writer,
                                   int version)
        Convert a TemplateQuery to XML and write XML to given writer.
        Parameters:
        template - the TemplateQuery
        writer - the XMLStreamWriter to write to
        version - the version number of the XML format
      • doMarshal

        public void doMarshal​(TemplateQuery template,
                              javax.xml.stream.XMLStreamWriter writer,
                              int version)
        Convert a TemplateQuery to XML and write XML to given writer.
        Parameters:
        template - the TemplateQuery
        writer - the XMLStreamWriter to write to
        version - the version number of the XML format
      • doAdditionalConstraintStuff

        public void doAdditionalConstraintStuff​(PathQuery query,
                                                PathConstraint constraint,
                                                javax.xml.stream.XMLStreamWriter writer)
                                         throws javax.xml.stream.XMLStreamException
        Adds any extra information for a constraint, like say Template extras.
        Overrides:
        doAdditionalConstraintStuff in class PathQueryBinding
        Parameters:
        query - the query
        constraint - the constraint being processed
        writer - a writer to add data to
        Throws:
        javax.xml.stream.XMLStreamException - if something goes wrong
      • marshal

        public static java.lang.String marshal​(TemplateQuery template,
                                               int version)
        Convert a TemplateQuery to XML
        Parameters:
        template - the TemplateQuery
        version - the version number of the XML format
        Returns:
        the corresponding XML String
      • unmarshalTemplates

        public static java.util.Map<java.lang.String,​TemplateQuery> unmarshalTemplates​(java.io.Reader reader,
                                                                                             int version)
        Parse TemplateQueries from XML.
        Parameters:
        reader - the saved templates
        version - the version of the xml format, an attribute of the ProfileManager
        Returns:
        a Map from template name to TemplateQuery
      • unmarshalJSONTemplates

        public static java.util.Map<java.lang.String,​TemplateQuery> unmarshalJSONTemplates​(java.io.Reader reader,
                                                                                                 Model model)
        Parse TemplateQueries from JSON.
        Parameters:
        reader - the saved templates
        model - the model
        Returns:
        a Map from template name to TemplateQuery