TypeMapper

nscn.polaris2.protoc.runtime.TypeMapper
See theTypeMapper companion object
trait TypeMapper[Base, Custom]

A bijection between a proto type and the Scala type a field should actually have.

This is the single extension point behind both user-declared (nscn.polaris2.protoc.field).type options and the built-in Well-Known Type mapping: the generated field has type Custom, while the wire format and reflective access stay in terms of Base.

toBase(toCustom(b)) == b is expected to hold. Where it cannot - java.time.Instant normalizes, so a Timestamp with nanos >= 1e9 does not come back unchanged - the mapping is documented and can be turned off per field.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def toBase(custom: Custom): Base
def toCustom(base: Base): Custom

Concrete methods

final def andThen[Other](that: TypeMapper[Custom, Other]): TypeMapper[Base, Other]

Composes with another mapping, so Base -> Custom -> Other becomes one mapper.

Composes with another mapping, so Base -> Custom -> Other becomes one mapper.

Attributes

final def inverse: TypeMapper[Custom, Base]