Packages

  • package root
    Definition Classes
    root
  • package play

    Play framework.

    Play framework.

    Play

    http://www.playframework.com

    Definition Classes
    root
  • package api

    Contains the public API for Scala developers.

    Contains the public API for Scala developers.

    Access the current Play application
    import play.api.Play.current
    Read configuration
    val poolSize = configuration.getInt("engine.pool.size")
    Use the logger
    Logger.info("Hello!")
    Define a Plugin
    class MyPlugin(app: Application) extends Plugin
    Create adhoc applications (for testing)
    val application = Application(new File("."), this.getClass.getClassloader, None, Play.Mode.DEV)
    Definition Classes
    play
  • package data

    Contains data manipulation helpers (typically HTTP form handling)

    Contains data manipulation helpers (typically HTTP form handling)

    import play.api.data._
    import play.api.data.Forms._
    
    val taskForm = Form(
      tuple(
        "name" -> text(minLength = 3),
        "dueDate" -> date("yyyy-MM-dd"),
        "done" -> boolean
      )
    )
    Definition Classes
    api
  • package format

    Contains the Format API used by Form.

    Contains the Format API used by Form.

    For example, to define a custom formatter:

    val signedIntFormat = new Formatter[Int] {
    
      def bind(key: String, data: Map[String, String]) = {
        stringFormat.bind(key, data).right.flatMap { value =>
          scala.util.control.Exception.allCatch[Int]
            .either(java.lang.Integer.parseInt(value))
            .left.map(e => Seq(FormError(key, "error.signedNumber", Nil)))
        }
      }
    
      def unbind(key: String, value: Long) = Map(
        key -> ((if (value<0) "-" else "+") + value)
      )
    }
    Definition Classes
    data
  • Formats
  • Formatter
  • JodaFormats
  • package validation

    Contains the validation API used by Form.

    Contains the validation API used by Form.

    For example, to define a custom constraint:

    val negative = Constraint[Int] {
      case i if i < 0 => Valid
      case _ => Invalid("Must be a negative number.")
    }
    Definition Classes
    data
p

play.api.data

format

package format

Contains the Format API used by Form.

For example, to define a custom formatter:

val signedIntFormat = new Formatter[Int] {

  def bind(key: String, data: Map[String, String]) = {
    stringFormat.bind(key, data).right.flatMap { value =>
      scala.util.control.Exception.allCatch[Int]
        .either(java.lang.Integer.parseInt(value))
        .left.map(e => Seq(FormError(key, "error.signedNumber", Nil)))
    }
  }

  def unbind(key: String, value: Long) = Map(
    key -> ((if (value<0) "-" else "+") + value)
  )
}
Source
package.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. format
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait Formatter[T] extends AnyRef

    Handles field binding and unbinding.

    Handles field binding and unbinding.

    Annotations
    @implicitNotFound( ... )

Value Members

  1. object Formats

    This object defines several default formatters.

  2. object JodaFormats

Inherited from AnyRef

Inherited from Any

Ungrouped