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 libs

    Contains various APIs that are useful while developing web applications.

    Contains various APIs that are useful while developing web applications.

    Definition Classes
    api
  • package json

    Json API

    Json API

    For example:

    import play.api.libs.json._
    import play.api.libs.functional.syntax._
    
    case class User(id: Long, name: String, friends: Seq[User] = Seq.empty)
    object User {
    
      // In this format, an undefined friends property is mapped to an empty list
      implicit val format: Format[User] = (
        (__ \ "id").format[Long] and
        (__ \ "name").format[String] and
        (__ \ "friends").lazyFormatNullable(implicitly[Format[Seq[User]]])
          .inmap[Seq[User]](_ getOrElse Seq.empty, Some(_))
      )(User.apply, unlift(User.unapply))
    }
    
    object MyController extends play.api.mvc.Controller {
       def displayUserAsJson(id: String) = Action {
          Ok(Json.toJson(User(id.toLong, "myName")))
       }
    
       def saveUser(jsonString: String)= Action {
         val user = Json.parse(jsonString).as[User]
         //myDataStore.save(user)
         Ok
       }
    }
    Definition Classes
    libs
  • package jackson
    Definition Classes
    json
  • PlayJsonModule

sealed class PlayJsonModule extends SimpleModule

The Play JSON module for Jackson.

This can be used if you want to use a custom Jackson ObjectMapper, or more advanced Jackson features when working with JsValue. To use this:

import com.fasterxml.jackson.databind.ObjectMapper

import play.api.libs.json.JsValue
import play.api.libs.json.jackson.PlayJsonModule
import play.api.libs.json.JsonParserSettings

val jsonParseSettings = JsonParserSettings()
val mapper = new ObjectMapper().registerModule(
  new PlayJsonModule(jsonParseSettings))
val jsValue = mapper.readValue("""{"foo":"bar"}""", classOf[JsValue])
Source
JacksonJson.scala
Linear Supertypes
SimpleModule, Serializable, Module, Versioned, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. PlayJsonModule
  2. SimpleModule
  3. Serializable
  4. Module
  5. Versioned
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new PlayJsonModule(parserSettings: JsonParserSettings)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def _checkNotNull(arg0: AnyRef, arg1: String): Unit
    Attributes
    protected[module]
    Definition Classes
    SimpleModule
  5. def addAbstractTypeMapping[T <: AnyRef](arg0: Class[T], arg1: Class[_ <: T]): SimpleModule
    Definition Classes
    SimpleModule
  6. def addDeserializer[T <: AnyRef](arg0: Class[T], arg1: JsonDeserializer[_ <: T]): SimpleModule
    Definition Classes
    SimpleModule
  7. def addKeyDeserializer(arg0: Class[_ <: AnyRef], arg1: KeyDeserializer): SimpleModule
    Definition Classes
    SimpleModule
  8. def addKeySerializer[T <: AnyRef](arg0: Class[_ <: T], arg1: JsonSerializer[T]): SimpleModule
    Definition Classes
    SimpleModule
  9. def addSerializer[T <: AnyRef](arg0: Class[_ <: T], arg1: JsonSerializer[T]): SimpleModule
    Definition Classes
    SimpleModule
  10. def addSerializer(arg0: JsonSerializer[_ <: AnyRef]): SimpleModule
    Definition Classes
    SimpleModule
  11. def addValueInstantiator(arg0: Class[_ <: AnyRef], arg1: ValueInstantiator): SimpleModule
    Definition Classes
    SimpleModule
  12. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  13. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  14. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  16. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  17. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  18. def getDependencies(): Iterable[_ <: Module]
    Definition Classes
    Module
  19. def getModuleName(): String
    Definition Classes
    SimpleModule → Module
  20. def getTypeId(): AnyRef
    Definition Classes
    SimpleModule → Module
  21. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  22. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  23. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  24. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  25. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  26. def registerSubtypes(arg0: Collection[Class[_ <: AnyRef]]): SimpleModule
    Definition Classes
    SimpleModule
  27. def registerSubtypes(arg0: <repeated...>[NamedType]): SimpleModule
    Definition Classes
    SimpleModule
    Annotations
    @transient()
  28. def registerSubtypes(arg0: <repeated...>[Class[_ <: AnyRef]]): SimpleModule
    Definition Classes
    SimpleModule
    Annotations
    @transient()
  29. def setAbstractTypes(arg0: SimpleAbstractTypeResolver): Unit
    Definition Classes
    SimpleModule
  30. def setDeserializerModifier(arg0: BeanDeserializerModifier): SimpleModule
    Definition Classes
    SimpleModule
  31. def setDeserializers(arg0: SimpleDeserializers): Unit
    Definition Classes
    SimpleModule
  32. def setKeyDeserializers(arg0: SimpleKeyDeserializers): Unit
    Definition Classes
    SimpleModule
  33. def setKeySerializers(arg0: SimpleSerializers): Unit
    Definition Classes
    SimpleModule
  34. def setMixInAnnotation(arg0: Class[_ <: AnyRef], arg1: Class[_ <: AnyRef]): SimpleModule
    Definition Classes
    SimpleModule
  35. def setNamingStrategy(arg0: PropertyNamingStrategy): SimpleModule
    Attributes
    protected[module]
    Definition Classes
    SimpleModule
  36. def setSerializerModifier(arg0: BeanSerializerModifier): SimpleModule
    Definition Classes
    SimpleModule
  37. def setSerializers(arg0: SimpleSerializers): Unit
    Definition Classes
    SimpleModule
  38. def setValueInstantiators(arg0: SimpleValueInstantiators): Unit
    Definition Classes
    SimpleModule
  39. def setupModule(context: SetupContext): Unit
    Definition Classes
    PlayJsonModule → SimpleModule → Module
  40. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  41. def toString(): String
    Definition Classes
    AnyRef → Any
  42. def version(): Version
    Definition Classes
    SimpleModule → Module → Versioned
  43. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  44. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  45. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from SimpleModule

Inherited from Serializable

Inherited from Module

Inherited from Versioned

Inherited from AnyRef

Inherited from Any

Ungrouped