All Downloads are FREE. Search and download functionalities are using the official Maven repository.

play.routes.compiler.ScalaFormat.scala Maven / Gradle / Ivy

There is a newer version: 3.0.6
Show newest version
/*
 * Copyright (C) from 2022 The Play Framework Contributors , 2011-2021 Lightbend Inc. 
 */

package play.routes.compiler

import scala.collection.immutable

import play.twirl.api.BufferedContent
import play.twirl.api.Format

/**
 * Twirl scala content type
 */
class ScalaContent(elements: immutable.Seq[ScalaContent], text: String)
    extends BufferedContent[ScalaContent](elements, text) {
  def this(text: String) = this(Nil, text)
  def this(elements: immutable.Seq[ScalaContent]) = this(elements, "")

  def contentType = "application/scala"
}

/**
 * Twirl Scala format
 */
object ScalaFormat extends Format[ScalaContent] {
  def raw(text: String) = new ScalaContent(text)

  def escape(text: String) = new ScalaContent(text)

  val empty = new ScalaContent(Nil)

  def fill(elements: immutable.Seq[ScalaContent]) = new ScalaContent(elements)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy