Captures case class parameter's default value.
Wrap your implicit instance of AsReal
, AsRaw
, AsRawReal
or RPC metadata (with companion that extends
RpcMetadataCompanion
) into Fallback in order to lower its implicit priority.
Useful when some implicit must be imported but we don't want it to get higher priority that imports normally
have over implicit scope (e.g. implicits from companion objects).
Wrap your implicit instance of AsReal
, AsRaw
, AsRawReal
or RPC metadata (with companion that extends
RpcMetadataCompanion
) into Fallback in order to lower its implicit priority.
Useful when some implicit must be imported but we don't want it to get higher priority that imports normally
have over implicit scope (e.g. implicits from companion objects).
NOTE: Fallback
does not work for *all* typeclasses, only RPC-related ones (AsReal
, AsRaw
, etc).
You can make it work with your own typeclass, but you must define appropriate forwarder in its companion, e.g.
trait FallbackAwareTC[T] { ... } object FallbackAwareTC { implicit def fromFallback[T](implicit f: Fallback[FallbackAwareTC[T]]): FallbackAwareTC[T] = f.value }
Intermediate factory that creates an Instances
trait based on provided Implicits
.
Intermediate factory that creates an Instances
trait based on provided Implicits
.
Normally, this factory is used as implicit constructor parameter of base classes for companion objects
of RPC traits (e.g. com.avsystem.commons.rest.DefaultRestApiCompanion
)
or ADTs (e.g. com.avsystem.commons.rest.RestDataCompanion
).
This all serves to reduce boilerplate associated with companion declarations and makes RPC trait or ADT
definitions as concise as possible. It also lets the programmer easily inject additional implicits into
macro-materialization of typeclasses aggregated by Instances
trait.
Instances
is a trait that aggregates multiple macro materialized typeclass instances.
There is no fixed interface for Instances
, its abstract methods are inspected by
MacroInstances.materialize
macro and implemented automatically as <methodReturnTypeCompanion>.materialize
Therefore, return type type of each method must have a companion object which contains materialize
macro.
You can customize this by applying MacroInstances.materializeWith annotation on methods of Instances
trait.
Example of Instances
: com.avsystem.commons.rest.ClientInstances
The Implicits
type specifies additional implicits that will be automatically imported into macro materialization.
Implicits
is usually a singleton type of an object which contains these implicits. It may also be a tuple -
contents of each tuple component will be imported independently. This way you can combine multiple sources
of additional implicits. If you don't want to import any additional implicits, simply use Unit
.
If MacroInstances
is accepted as implicit super constructor parameter of a companion object
(which is the typical situation) then this
reference should be passed as companion
.
This is in order to work around https://github.com/scala/bug/issues/7666.
Actual typeclass instances aggregated by Instances
trait should be extracted into implicit lazy val
definitions in the companion base class. See e.g. com.avsystem.commons.rest.RestDataCompanion
for an example of how it's done.
Simple immutable structure to collect named values while retaining their order and providing fast, hashed lookup by name when necessary.
Simple immutable structure to collect named values while retaining their order and
providing fast, hashed lookup by name when necessary.
Intended to be used for multi raw parameters.
When caseInsensitive = true
, fetching values by name will be case-insensitive, i.e. keys in internal
hashmap and those passed to contains
, isDefinedAt
, apply
and applyOrElse
will be lowercased.
Information about real parameter flags and modifiers as defined in Scala code.
Information about real parameter flags and modifiers as defined in Scala code.
Information about real parameter position in its method.
Information about real parameter position in its method. All indices start from 0.
overall index of the parameter, among all parameter lists
index of parameter list that this parameter belongs to
index of the parameter inside its parameter list
index of the parameter in its corresponding @multi
metadata parameter
(or zero if not @multi
)
Information about real parameter flags and modifiers as defined in Scala code.
Information about real parameter flags and modifiers as defined in Scala code.
This trait must be extended by all method metadata classes and all parameter metadata classes.
This trait must be extended by all method metadata classes and all parameter metadata classes.
For method metadata, type parameter T
will be matched against each real method result type.
For parameter metadata, type parameter T
will be matched against each real parameter type.
Captures case class parameter's default value. Used as type of ADT metadata parameter annotated with reifyDefaultValue.