made.annotation

package made.annotation

Annotation system for Made mirrors.

Annotations extending made.annotation.MetaAnnotation are refining annotations: they refine the type of the annotated element and are captured in the Metadata type member during Made.derived. Query them at runtime via hasAnnotation[A] and getAnnotation[A] on a Made instance.

Attributes

See also

Members list

Type members

Classlikes

Base trait for annotations that aggregate multiple other annotations. An aggregate annotation works like an "annotation function" — applying it to a symbol behaves as if all the annotations declared on its aggregated method were applied directly.

Base trait for annotations that aggregate multiple other annotations. An aggregate annotation works like an "annotation function" — applying it to a symbol behaves as if all the annotations declared on its aggregated method were applied directly.

To declare an aggregate, extend AnnotationAggregate and implement the aggregated method via the reifyAggregated macro. The aggregated annotations must be declared on that implementation method itself. The implementation must be final.

Constructor parameters of the aggregate may be referenced as arguments to inner annotations and will be substituted at the application site:

 class customName(name: String) extends AnnotationAggregate {
   @name(name)
   final def aggregated: List[StaticAnnotation] = reifyAggregated
 }

Made's annotation lookup machinery (hasAnnotation/getAnnotation on mirror elements, label resolution and metadata) automatically expands aggregates so that downstream code sees the underlying annotations directly.

Attributes

Supertypes
class Annotation
class Object
trait Matchable
class Any
open class MetaAnnotation extends RefiningAnnotation

Base class for all Made meta-annotations.

Base class for all Made meta-annotations.

Extends RefiningAnnotation so that annotations refine the type of the annotated element. Annotations extending this class are automatically captured in the Metadata type member during Made.derived and can be queried at runtime via hasAnnotation[A] and getAnnotation[A] extension methods on a Made instance.

Custom annotations should extend this class to participate in the Made metadata system.

Attributes

See also
Supertypes
class Annotation
class Object
trait Matchable
class Any
Show all
Known subtypes
class generated
class repeated
class transparent
class whenAbsent[T]
class generated extends MetaAnnotation

Marks a val or def to be included in Made.GeneratedElems.

Marks a val or def to be included in Made.GeneratedElems.

The annotated member becomes a made.GeneratedMadeElem with an apply(outer) method that computes its value from an instance of the declaring type. Only valid on vals and defs, not on constructor parameters or other members.

Attributes

See also
Supertypes
class Annotation
class Object
trait Matchable
class Any
Show all
class name(val name: String) extends RefiningAnnotation

Overrides the Label type member for the annotated type or field.

Overrides the Label type member for the annotated type or field.

The name parameter becomes the compile-time string literal used as Label. Can be applied to both types (overrides Made.Label) and fields (overrides MadeElem.Label).

Value parameters

name

the label override

Attributes

See also
Supertypes
class Annotation
class Object
trait Matchable
class Any
Show all

Marks a field to use Default[T].apply() as its default value.

Marks a field to use Default[T].apply() as its default value.

Requires a Default instance for the field's type to be in implicit scope. In the default resolution priority chain: @whenAbsent > @optionalParam > constructor default.

Attributes

See also
Supertypes
class Annotation
class Object
trait Matchable
class Any
Show all
class repeated extends MetaAnnotation

Marker injected by Made.derived on fields declared with varargs (T*).

Marker injected by Made.derived on fields declared with varargs (T*).

Users do not write @repeated on their case classes — the macro adds it to the field's Metadata whenever the underlying parameter symbol carries the Repeated flag. Consumers can query it via hasAnnotation[repeated] to discover that the field originated from a varargs parameter, even though the field type itself appears as Seq[T].

Attributes

See also
Supertypes
class Annotation
class Object
trait Matchable
class Any
Show all
class transparent extends MetaAnnotation

Marks a case class for Made.Transparent derivation instead of Made.Product.

Marks a case class for Made.Transparent derivation instead of Made.Product.

The case class must have exactly one constructor field. @generated members are not supported on @transparent types and will cause a compile error. The resulting mirror provides wrap/unwrap methods for the single field.

Attributes

See also
Supertypes
class Annotation
class Object
trait Matchable
class Any
Show all
object whenAbsent

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
whenAbsent.type
class whenAbsent[+T](v: => T) extends MetaAnnotation

Provides an explicit default value for a constructor parameter with highest priority in the default resolution chain.

Provides an explicit default value for a constructor parameter with highest priority in the default resolution chain.

The value is by-name (=> T) so it is evaluated lazily each time default is called on the corresponding made.MadeFieldElem.

Priority chain: @whenAbsent > @optionalParam > constructor default.

Type parameters

T

the type of the default value

Value parameters

v

the default value, evaluated lazily

Attributes

See also
Companion
object
Supertypes
class Annotation
class Object
trait Matchable
class Any
Show all