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.

    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

object Formats

This object defines several default formatters.

Source
Format.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Formats
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. def bigDecimalFormat(precision: Option[(Int, Int)]): Formatter[BigDecimal]

    Default formatter for the BigDecimal type.

  2. implicit val bigDecimalFormat: Formatter[BigDecimal]

    Default formatter for the BigDecimal type with no precision

  3. implicit def booleanFormat: Formatter[Boolean]

    Default formatter for the Boolean type.

  4. implicit def byteFormat: Formatter[Byte]

    Default formatter for the Byte type.

  5. implicit def charFormat: Formatter[Char]

    Default formatter for the Char type.

  6. def dateFormat(pattern: String, timeZone: TimeZone = TimeZone.getDefault): Formatter[Date]

    Formatter for the java.util.Date type.

    Formatter for the java.util.Date type.

    pattern

    a date pattern, as specified in java.time.format.DateTimeFormatter.

    timeZone

    the java.util.TimeZone to use for parsing and formatting

  7. implicit val dateFormat: Formatter[Date]

    Default formatter for the java.util.Date type with pattern yyyy-MM-dd.

  8. implicit def doubleFormat: Formatter[Double]

    Default formatter for the Double type.

  9. implicit def floatFormat: Formatter[Float]

    Default formatter for the Float type.

  10. def ignoredFormat[A](value: A): Formatter[A]

    Formatter for ignored values.

    Formatter for ignored values.

    value

    As we ignore this parameter in binding/unbinding we have to provide a default value.

  11. implicit def intFormat: Formatter[Int]

    Default formatter for the Int type.

  12. def localDateFormat(pattern: String): Formatter[LocalDate]

    Formatter for the java.time.LocalDate type.

    Formatter for the java.time.LocalDate type.

    pattern

    a date pattern as specified in java.time.format.DateTimeFormatter.

  13. implicit val localDateFormat: Formatter[LocalDate]

    Default formatter for java.time.LocalDate type with pattern yyyy-MM-dd.

  14. def localDateTimeFormat(pattern: String, zoneId: ZoneId = java.time.ZoneId.systemDefault()): Formatter[LocalDateTime]

    Formatter for the java.time.LocalDateTime type.

    Formatter for the java.time.LocalDateTime type.

    pattern

    a date pattern as specified in java.time.format.DateTimeFormatter.

    zoneId

    the java.time.ZoneId to use for parsing and formatting

  15. implicit val localDateTimeFormat: Formatter[LocalDateTime]

    Default formatter for java.time.LocalDateTime type with pattern yyyy-MM-dd.

  16. def localTimeFormat(pattern: String): Formatter[LocalTime]

    Formatter for the java.time.LocalTime type.

    Formatter for the java.time.LocalTime type.

    pattern

    a date pattern as specified in java.time.format.DateTimeFormatter.

  17. implicit val localTimeFormat: Formatter[LocalTime]

    Default formatter for java.time.LocalTime type with pattern HH:mm:ss.

  18. implicit def longFormat: Formatter[Long]

    Default formatter for the Long type.

  19. def parsing[T](parse: (String) => T, errMsg: String, errArgs: Seq[Any])(key: String, data: Map[String, String]): Either[Seq[FormError], T]

    Helper for formatters binders

    Helper for formatters binders

    parse

    Function parsing a String value into a T value, throwing an exception in case of failure

    errArgs

    Error to set in case of parsing failure

    key

    Key name of the field to parse

    data

    Field data

  20. implicit def shortFormat: Formatter[Short]

    Default formatter for the Short type.

  21. def sqlDateFormat(pattern: String): Formatter[Date]

    Formatter for the java.sql.Date type.

    Formatter for the java.sql.Date type.

    pattern

    a date pattern as specified in java.time.DateTimeFormatter.

  22. implicit val sqlDateFormat: Formatter[Date]

    Default formatter for java.sql.Date type with pattern yyyy-MM-dd.

  23. def sqlTimestampFormat(pattern: String, timeZone: TimeZone = TimeZone.getDefault): Formatter[Timestamp]

    Formatter for the java.sql.Timestamp type.

    Formatter for the java.sql.Timestamp type.

    pattern

    a date pattern as specified in java.time.DateTimeFormatter.

    timeZone

    the java.util.TimeZone to use for parsing and formatting

  24. implicit val sqlTimestampFormat: Formatter[Timestamp]

    Default formatter for java.sql.Timestamp type with pattern yyyy-MM-dd HH:mm:ss.

  25. implicit def stringFormat: Formatter[String]

    Default formatter for the String type.

  26. implicit def uuidFormat: Formatter[UUID]

    Default formatter for the java.util.UUID type.