object CourierSerializer
Provides methods for serializing and deserializing the Pegasus data types used by Courier to JSON.
This uses org.coursera.pegasus.TypedDefinitionCodec, the default codec for use with Courier at Coursera.
For example, given a generated Courier data binding class named Profile, to serialize the
Courier data binding class (a.k.a. data template) to JSON:
val profile = Profile(...)
val jsonString = CourierSerializer.write(profile)
And to Deserialize JSON to the Courier data binding:
val profile = CourierSerializer.read[Profile](jsonString)
- Alphabetic
- By Inheritance
- CourierSerializer
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- class TemplateBuilder[T <: DataTemplate[_ <: AnyRef]] extends AnyRef
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- def builder[T <: DataTemplate[_ <: AnyRef]](clazz: Class[T]): TemplateBuilder[T]
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getDeclaringTyperefSchema[T <: DataTemplate[_]](implicit clazz: Class[T]): Option[TyperefDataSchema]
For unions declared in a typeref, gets the typeref schema.
- def getSchema[T <: DataTemplate[_]](implicit clazz: Class[T]): DataSchema
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
read[T <: DataTemplate[DataMap]](json: String)(implicit tag: ClassTag[T]): T
Reads a record template from a JSON string.
Reads a record template from a JSON string.
- Exceptions thrown
org.coursera.courier.templates.DataValidationExceptionif validation fails.
-
def
readUnion[T <: UnionTemplate](json: String)(implicit tag: ClassTag[T]): T
Reads a union template from a JSON string.
Reads a union template from a JSON string.
- Exceptions thrown
org.coursera.courier.templates.DataValidationExceptionif validation fails.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
- def write[T <: DataTemplate[DataMap]](template: T)(implicit tag: ClassTag[T]): String
- def writeUnion[T <: UnionTemplate](template: T)(implicit tag: ClassTag[T]): String