final class optional extends Annotation with SymbolArity

When applied on raw method, it works almost the same way as single except that it is not required that matching real method exists in real RPC trait. If there is no matching real method, macro-materialized AsRaw implementation will implement the raw method with a code that throws an exception.

When applied on raw parameter, specifies that this raw parameter may be matched by a real parameter but this is not required. Whether a real parameter matches an optional raw parameter is determined by its type and/or tag (see paramTag for more information on param tagging).

Raw parameters marked as optional must be typed as Option[T] (or Opt[T], OptArg[T] or whatever type that has an instance of OptionLike). By default, optional raw parameters are verbatim which means that the option-wrapped type T must match exactly the type of real parameter.

In the macro generated code that translates a raw call into a real call, when the raw parameter value is absent (the Option[T] is empty) then real parameter's default value will be used as fallback. This allows introducing new parameters into RPC interfaces without breaking backwards compatibility.

optional may also be used on method metadata parameters or parameter metadata parameters. It works the same way as with single except that metadata class must be wrapped in an OptionLike type (Option, Opt, etc.).

Finally, optional may also be used for metadata parameters that hold reified annotations (see reifyAnnot). In that case it is not required that the annotation being reified is actually present on the real trait/method/param. For that to work, metadata param must be typed as Option[A], Opt[A], etc. where A is the type of annotation being reified.

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. optional
  2. SymbolArity
  3. RawParamAnnotation
  4. RawSymAnnotation
  5. StaticAnnotation
  6. Annotation
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new optional()