com.github.plokhotnyuk.jsoniter_scala.macros

Type members

Classlikes

class CodecMakerConfig(val fieldNameMapper: NameMapper, val javaEnumValueNameMapper: NameMapper, val adtLeafClassNameMapper: NameMapper, val discriminatorFieldName: Option[String], val isStringified: Boolean, val mapAsArray: Boolean, val skipUnexpectedFields: Boolean, val transientDefault: Boolean, val transientEmpty: Boolean, val transientNone: Boolean, val requireCollectionFields: Boolean, val bigDecimalPrecision: Int, val bigDecimalScaleLimit: Int, val bigDecimalDigitsLimit: Int, val bigIntDigitsLimit: Int, val bitSetValueLimit: Int, val mapMaxInsertNumber: Int, val setMaxInsertNumber: Int, val allowRecursiveTypes: Boolean, val requireDiscriminatorFirst: Boolean, val useScalaEnumValueId: Boolean)

Configuration parameter for JsonCodecMaker.make() call.

Configuration parameter for JsonCodecMaker.make() call.

BEWARE: a parameter of the make macro should not depend on code from the same compilation module where it is called. Use a separated submodule of the project to compile all such dependencies before their usage for generation of codecs.

Examples of fieldNameMapper, javaEnumValueNameMapper, and adtLeafClassNameMapper functions that have no dependencies in the same compilation module are: JsonCodecMaker.enforceCamelCase, JsonCodecMaker.enforce_snake_case, JsonCodecMaker.enforce-kebab-case, and JsonCodecMaker.simpleClassName. Or their composition like: s => JsonCodecMaker.enforce_snake_case(JsonCodecMaker.simpleClassName(s))

Value parameters:
adtLeafClassNameMapper

the function of mapping from string of case class/object full name to string value of discriminator field (a function that truncate to simple class name by default)

allowRecursiveTypes

a flag that turns on support of recursive types (turned off by default)

bigDecimalDigitsLimit

an exclusive limit for accepted number of mantissa digits of to be parsed before rounding with the precision specified for 'BigDecimal' values (308 by default)

bigDecimalPrecision

a precision in 'BigDecimal' values (34 by default)

bigDecimalScaleLimit

an exclusive limit for accepted scale in 'BigDecimal' values (6178 by default)

bigIntDigitsLimit

an exclusive limit for accepted number of decimal digits in 'BigInt' values (308 by default)

bitSetValueLimit

an exclusive limit for accepted numeric values in bit sets (1024 by default)

discriminatorFieldName

an optional name of discriminator field, where None can be used for alternative representation of ADTs without the discriminator field (Some("type") by default)

fieldNameMapper

the partial function of mapping from string of case class field name to JSON key (an identity function by default)

isStringified

a flag that turns on stringification of number or boolean values of collections, options and value classes (turned off by default)

javaEnumValueNameMapper

the partial function of mapping from string of Java enum name to JSON key (an identity function by default)

mapAsArray

a flag that turns on serialization and parsing of maps as a JSON array (or sequences of tuples) instead of a JSON object, that allow to use 'JsonValueCodec' for encoding and decoding of keys (turned off by default)

mapMaxInsertNumber

a max number of inserts into maps (1024 by default)

requireDiscriminatorFirst

a flag that turns off limitation for a position of the discriminator field to be the first field of the JSON object (turned on by default)

setMaxInsertNumber

a max number of inserts into sets excluding bit sets (1024 by default)

skipUnexpectedFields

a flag that turns on skipping of unexpected fields or in other case a parse exception will be thrown (turned on by default)

transientDefault

(always OFF in scala3) a flag that turns on skipping serialization of fields that have same values as default values defined for them in the primary constructor (turned on by default)

transientEmpty

a flag that turns on skipping serialization of fields that have empty values of arrays or collections (turned on by default)

transientNone

a flag that turns on skipping serialization of fields that have empty values of options (turned on by default)

useScalaEnumValueId

a flag that turns on using of ids for parsing and serialization of Scala enumeration values

Companion:
object
Companion:
class
class ExprPartialFunctionWrapper(fun: Expr[PartialFunction[String, String]]) extends NameMapper
case class FromExprException(name: String, expr: Expr[Any]) extends RuntimeException
sealed trait NameMapper
Companion:
object
object NameMapper
Companion:
class
class PartialFunctionWrapper(fun: PartialFunction[String, String]) extends NameMapper
Companion:
object
@field
final class named(val name: String) extends StaticAnnotation
@field
final class stringified extends StaticAnnotation
@field
final class transient extends StaticAnnotation