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.
- Alphabetic
- By Inheritance
- optional
- SymbolArity
- RawParamAnnotation
- RawSymAnnotation
- StaticAnnotation
- Annotation
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new optional()
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )