<commit_before>package io.fintrospect

import argo.jdom.JsonRootNode
import io.fintrospect.parameters.BodySpec
import org.jboss.netty.handler.codec.http.HttpResponseStatus

import scala.util.Try

/**
 * Defines a potential response from a route, with a possible example
 */
class ResponseSpec private[fintrospect](statusAndDescription: (HttpResponseStatus, String), val example: Option[String] = None) {
  val status = statusAndDescription._1
  val description = statusAndDescription._2
}

object ResponseSpec {
  def json(statusAndDescription: (HttpResponseStatus, String), example: JsonRootNode): ResponseSpec = {
    ResponseSpec(statusAndDescription, example, BodySpec.json())
  }

  def apply(statusAndDescription: (HttpResponseStatus, String)): ResponseSpec = new ResponseSpec(statusAndDescription)

  def apply[T](statusAndDescription: (HttpResponseStatus, String), example: T, bodySpec: BodySpec[T]): ResponseSpec = {
    new ResponseSpec(statusAndDescription, Try(bodySpec.serialize(example)).toOption)
  }
}<commit_msg>dave -  added xml responsespec<commit_after>package io.fintrospect

import argo.jdom.JsonRootNode
import io.fintrospect.parameters.BodySpec
import org.jboss.netty.handler.codec.http.HttpResponseStatus

import scala.util.Try
import scala.xml.Elem

/**
 * Defines a potential response from a route, with a possible example
 */
class ResponseSpec private[fintrospect](statusAndDescription: (HttpResponseStatus, String), val example: Option[String] = None) {
  val status = statusAndDescription._1
  val description = statusAndDescription._2
}

object ResponseSpec {
  def json(statusAndDescription: (HttpResponseStatus, String), example: JsonRootNode): ResponseSpec = {
    ResponseSpec(statusAndDescription, example, BodySpec.json())
  }

  def xml(statusAndDescription: (HttpResponseStatus, String), example: Elem): ResponseSpec = {
    ResponseSpec(statusAndDescription, example, BodySpec.xml())
  }

  def apply(statusAndDescription: (HttpResponseStatus, String)): ResponseSpec = new ResponseSpec(statusAndDescription)

  def apply[T](statusAndDescription: (HttpResponseStatus, String), example: T, bodySpec: BodySpec[T]): ResponseSpec = {
    new ResponseSpec(statusAndDescription, Try(bodySpec.serialize(example)).toOption)
  }
}
{'fraction_non_alphanumeric': 0.09907120743034056, 'fraction_numerical': 0.0017691287041132243, 'mean_word_length': 6.490066225165563, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2395478', 'n_tokens_mistral': 633, 'n_tokens_neox': 622, 'n_words': 149}