Trait

com.avsystem.commons.annotation

AnnotationAggregate

Related Doc: package annotation

Permalink

trait AnnotationAggregate extends Annotation with StaticAnnotation

Base trait for annotations which aggregate multiple other annotations. This way annotation aggregates work like "annotation functions" - they are annotations that yield more annotations.

In order to specify aggregated annotations, the class that extends AnnotationAggregate must redefine the Implied dummy type member and apply the aggregated annotations on it. Macro engines used in GenCodec materialization and RPC framework will automatically pick up these annotations.

import com.avsystem.commons.serialization._

class mongoId extends AnnotationAggregate {
  @name("_id") @outOfOrder
  type Implied
}

case class SomeMongoEntity(@mongoId id: String, data: String)

In the above example, applying @mongoId annotation on the id field has the same effect as if annotations @name("_id") @outOfOrder were applied directly on that field.

NOTE: thanks to the fact that aggregated annotations are applied on a type member you can pass the arguments of original annotation to aggregated annotations, e.g.

class rpcNameAndDescription(name: String, description: String) extends AnnotationAggregate {
  @rpcName(name) // passing `name` to aggregated annotation
  type Implied
}
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AnnotationAggregate
  2. StaticAnnotation
  3. Annotation
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. abstract type Implied

    Permalink

    Dummy type member meant to be redefined in order to have aggregated annotations applied on it.

    Dummy type member meant to be redefined in order to have aggregated annotations applied on it. These annotations will be automatically picked up by macro engines each time they encounter the aggregating annotation itself. Other than being an "anchor" for annotations, this type member has no actual meaning and there is no reason to ever actually use it. NOTE: a less weird solution would be to put aggregated annotations on the aggregating annotation class itself, but this would make it impossible to access the arguments of aggregating annotation in aggregated annotations.

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  10. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  11. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  13. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  14. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  15. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  16. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  17. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from StaticAnnotation

Inherited from Annotation

Inherited from AnyRef

Inherited from Any

Ungrouped