case class JsonFormatBuilder[C <: HList, FC <: HList](fields: FC)(implicit aux: FormatterAux[C, FC]) extends Product with Serializable
A type-safe way to construct a JSONFormat by incrementally adding, removing or updating fields.
- C
the type of the
HListof fields currently in this builder- FC
the type of the
HListof field definitions currently in this builder- fields
the fields currently in this builder
- Alphabetic
- By Inheritance
- JsonFormatBuilder
- Serializable
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
JsonFormatBuilder(fields: FC)(implicit aux: FormatterAux[C, FC])
- fields
the fields currently in this builder
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
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
customJsonFormat[A](preRead: (JsObject) ⇒ JsObject, readFunc: ReadFunc[A], writeFunc: WriteFunc[A], postWrite: (A, JsObject) ⇒ JsObject, errorHandler: (JsValue, Throwable) ⇒ A = defaultErrorHandler): RootJsonFormat[A]
Returns a
JSONFormatfor objects of a type using the current list of fields defined and custom transformations.Returns a
JSONFormatfor objects of a type using the current list of fields defined and custom transformations.- A
the type of objects for which a
JSONFormatis to be returned- preRead
a function transforming the JSON content before reads
- readFunc
a function converting the list of fields to an instance of
A- writeFunc
a function extracting the list of fields from an instance of
A- postWrite
a function transforming the JSON content after writes
- errorHandler
a function to catch and possibly recover from errors
- returns
a
JSONFormatfor objects of typeA.
-
def
customJsonReader[A](preRead: (JsObject) ⇒ JsObject, readFunc: ReadFunc[A], errorHandler: (JsValue, Throwable) ⇒ A = defaultErrorHandler): RootJsonReader[A]
Returns a
JSONReaderfor objects of a type using the current list of fields defined and custom transformations.Returns a
JSONReaderfor objects of a type using the current list of fields defined and custom transformations.- A
the type of objects for which a
JSONFormatis to be returned- preRead
a function transforming the JSON content before reads
- readFunc
a function converting the list of fields to an instance of
A- errorHandler
a function to catch and possibly recover from errors
- returns
a
JSONReaderfor objects of typeA.
-
def
customJsonWriter[A](writeFunc: WriteFunc[A], postWrite: (A, JsObject) ⇒ JsObject): RootJsonWriter[A]
Returns a
JSONWriterfor objects of a type using the current list of fields defined and custom transformations.Returns a
JSONWriterfor objects of a type using the current list of fields defined and custom transformations.- A
the type of objects for which a
JSONFormatis to be returned- writeFunc
a function extracting the list of fields from an instance of
A- postWrite
a function transforming the JSON content after writes
- returns
a
JSONWriterfor objects of typeA.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
field[A](name: String, default: A, jf: JsonFormat[A])(implicit ev: AppenderAux[A, C, FC], dummy: DummyImplicit): JsonFormatBuilder[COut, FCOut]
Adds a field to this builder.
Adds a field to this builder.
- A
the type of the new field
- name
the name of the new field
- default
the default value of the new field
- jf
a
JSONFormatto use in the new field- returns
a new instance of
JsonFormatBuilderwith the new field
-
def
field[A](name: String, default: A)(implicit jf: JsonFormat[A], ev: AppenderAux[A, C, FC]): JsonFormatBuilder[COut, FCOut]
Adds a field to this builder.
Adds a field to this builder.
- A
the type of the new field
- name
the name of the new field
- default
the default value of the new field
- returns
a new instance of
JsonFormatBuilderwith the new field
-
def
field[A](name: String)(implicit jf: JsonFormat[A], ev: AppenderAux[A, C, FC]): JsonFormatBuilder[COut, FCOut]
Adds a field to this builder.
Adds a field to this builder.
- A
the type of the new field
- name
the name of the new field
- returns
a new instance of
JsonFormatBuilderwith the new field
- val fields: FC
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
jsonFormat[A](readFunc: ReadFunc[A], writeFunc: WriteFunc[A]): RootJsonFormat[A]
Returns a
JSONFormatfor objects of a type using the current list of fields defined.Returns a
JSONFormatfor objects of a type using the current list of fields defined.- A
the type of objects for which a
JSONFormatis to be returned- readFunc
a function converting the list of fields to an instance of
A- writeFunc
a function extracting the list of fields from an instance of
A- returns
a
JSONFormatfor objects of typeA.
-
def
jsonReader[A](readFunc: ReadFunc[A]): RootJsonReader[A]
Returns a
JSONReaderfor objects of a type using the current list of fields defined.Returns a
JSONReaderfor objects of a type using the current list of fields defined.- A
the type of objects for which a
JSONFormatis to be returned- readFunc
a function converting the list of fields to an instance of
A- returns
a
JSONFormatfor objects of typeA.
-
def
jsonWriter[A](writeFunc: WriteFunc[A]): RootJsonWriter[A]
Returns a
JSONWriterfor objects of a type using the current list of fields defined.Returns a
JSONWriterfor objects of a type using the current list of fields defined.- A
the type of objects for which a
JSONFormatis to be returned- writeFunc
a function extracting the list of fields from an instance of
A- returns
a
JSONFormatfor objects of typeA.
-
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
optionalField[A](name: String, jf: JsonFormat[A])(implicit ev: AppenderAux[Option[A], C, FC], dummy: DummyImplicit): JsonFormatBuilder[COut, FCOut]
Adds an optional field to this builder which defaults to
None.Adds an optional field to this builder which defaults to
None.- A
the type of the new field
- name
the name of the new field
- jf
a
JSONFormatto use in the new field- returns
a new instance of
JsonFormatBuilderwith the new field
-
def
optionalField[A](name: String)(implicit jf: JsonFormat[A], ev: AppenderAux[Option[A], C, FC]): JsonFormatBuilder[COut, FCOut]
Adds an optional field to this builder which defaults to
None.Adds an optional field to this builder which defaults to
None.- A
the type of the new field
- name
the name of the new field
- returns
a new instance of
JsonFormatBuilderwith the new field
-
def
removeField[N <: Nat](implicit ev: RemoverAux[C, FC, N]): JsonFormatBuilder[COut, FCOut]
Removes a field in this builder.
Removes a field in this builder.
- N
the index of the field to remove
- returns
a new instance of
JsonFormatBuilderwith the field removed
-
def
replaceField[N <: Nat, A](name: String, default: A, jf: JsonFormat[A])(implicit ev: ReplacerAux[A, C, FC, N], dummy: DummyImplicit): JsonFormatBuilder[COut, FCOut]
Replaces a field in this builder with another one.
Replaces a field in this builder with another one.
- N
the index of the field to replace
- A
the type of the new field
- name
the name of the new field
- default
the default value of the new field
- jf
a
JSONFormatto use in the new field- returns
a new instance of
JsonFormatBuilderwith the field replaced
-
def
replaceField[N <: Nat, A](name: String, default: A)(implicit jf: JsonFormat[A], ev: ReplacerAux[A, C, FC, N]): JsonFormatBuilder[COut, FCOut]
Replaces a field in this builder with another one.
Replaces a field in this builder with another one.
- N
the index of the field to replace
- A
the type of the new field
- name
the name of the new field
- default
the default value of the new field
- returns
a new instance of
JsonFormatBuilderwith the field replaced
-
def
replaceField[N <: Nat, A](name: String)(implicit jf: JsonFormat[A], ev: ReplacerAux[A, C, FC, N]): JsonFormatBuilder[COut, FCOut]
Replaces a field in this builder with another one.
Replaces a field in this builder with another one.
- N
the index of the field to replace
- A
the type of the new field
- name
the name of the new field
- returns
a new instance of
JsonFormatBuilderwith the field replaced
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
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
- @native() @throws( ... )