A binding resolver provides bindings for types during schema rebinding.
BindingResolver is the read-only interface for looking up bindings by type identity. Multiple resolvers can be combined using ++ to form resolution chains with fallback behavior.
The library provides several resolver implementations:
- BindingResolver.Registry: A map-backed resolver for explicit bindings
- BindingResolver.reflection: A resolver that derives record bindings using runtime reflection (JVM only)
- BindingResolver.defaults: Pre-configured bindings for primitives, java.time, and common collections
Attributes
- Example
-
import zio.blocks.schema.binding._ case class Person(name: String, age: Int) val customRegistry = BindingResolver.empty.bind(Binding.of[Person]) // Use defaults for primitives and collections, with custom bindings val resolver = customRegistry ++ BindingResolver.defaults // Add reflection-based derivation as fallback val withReflection = customRegistry ++ BindingResolver.reflection ++ BindingResolver.defaults - Companion
- object
- Source
- BindingResolver.scala
- Graph
-
- Supertypes
- Known subtypes
-
class Registry
- Self type
Members list
Value members
Abstract methods
Resolves the dynamic binding.
Resolves the dynamic binding.
Value parameters
- typeId
-
The TypeId for DynamicValue (usually derived implicitly)
Attributes
- Returns
-
The binding if found, None otherwise
- Source
- BindingResolver.scala
Resolves a map binding for an applied map type.
Resolves a map binding for an applied map type.
Uses UnapplyMap to decompose the applied type and resolve the binding by type constructor.
Type parameters
- X
-
The applied map type (e.g.,
Map[String, Int])
Value parameters
- typeId
-
The TypeId for type X (usually derived implicitly)
- u
-
Evidence that X is an applied map type
Attributes
- Returns
-
The binding if found, None otherwise
- Source
- BindingResolver.scala
Resolves a map binding given an explicit TypeId for the applied type.
Resolves a map binding given an explicit TypeId for the applied type.
This variant is useful when you already have the map type constructor and key/value types as separate type parameters.
Type parameters
- K
-
The key type
- M
-
The map type constructor (e.g.,
Map) - V
-
The value type
Value parameters
- typeId
-
The TypeId for the applied type
M[K, V]
Attributes
- Returns
-
The binding if found, None otherwise
- Source
- BindingResolver.scala
Resolves a primitive binding for a type.
Resolves a primitive binding for a type.
Type parameters
- A
-
The type to resolve
Value parameters
- typeId
-
The TypeId for type A (usually derived implicitly)
Attributes
- Returns
-
The binding if found, None otherwise
- Source
- BindingResolver.scala
Resolves a record binding for a type.
Resolves a record binding for a type.
Type parameters
- A
-
The type to resolve
Value parameters
- typeId
-
The TypeId for type A (usually derived implicitly)
Attributes
- Returns
-
The binding if found, None otherwise
- Source
- BindingResolver.scala
Resolves a sequence binding for an applied sequence type.
Resolves a sequence binding for an applied sequence type.
Uses UnapplySeq to decompose the applied type and resolve the binding by type constructor.
Type parameters
- X
-
The applied sequence type (e.g.,
List[Int])
Value parameters
- typeId
-
The TypeId for type X (usually derived implicitly)
- u
-
Evidence that X is an applied sequence type
Attributes
- Returns
-
The binding if found, None otherwise
- Source
- BindingResolver.scala
Resolves a sequence binding given an explicit TypeId for the applied type.
Resolves a sequence binding given an explicit TypeId for the applied type.
This variant is useful when you already have the type constructor and element type as separate type parameters.
Type parameters
- A
-
The element type
- C
-
The sequence type constructor (e.g.,
List)
Value parameters
- typeId
-
The TypeId for the applied type
C[A]
Attributes
- Returns
-
The binding if found, None otherwise
- Source
- BindingResolver.scala
Resolves a variant binding for a type.
Resolves a variant binding for a type.
Type parameters
- A
-
The type to resolve
Value parameters
- typeId
-
The TypeId for type A (usually derived implicitly)
Attributes
- Returns
-
The binding if found, None otherwise
- Source
- BindingResolver.scala
Resolves a wrapper binding for a type.
Resolves a wrapper binding for a type.
Type parameters
- A
-
The wrapper type
Value parameters
- typeId
-
The TypeId for type A (usually derived implicitly)
Attributes
- Returns
-
The binding if found, None otherwise
- Source
- BindingResolver.scala
Concrete methods
Combines this resolver with another, trying this resolver first.
Combines this resolver with another, trying this resolver first.
When resolving a binding, the combined resolver tries this first. If this returns None, it falls back to that.
Value parameters
- that
-
The fallback resolver
Attributes
- Returns
-
A combined resolver that tries
thisfirst, thenthat - Example
-
import zio.blocks.schema.binding._ case class Person(name: String, age: Int) val customRegistry = BindingResolver.empty.bind(Binding.of[Person]) // customRegistry overrides defaults val resolver = customRegistry ++ BindingResolver.defaults - Source
- BindingResolver.scala