tagan.lang-api.1.5.1.source-code.BuiltinAnnotation.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lang-api Show documentation
Show all versions of lang-api Show documentation
Yatagan is a Dependency Injection framework, specializing on runtime performance and build speed. Supports code generation (apt/kapt/ksp) or reflection.
The newest version!
/*
* Copyright 2022 Yandex LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yandex.yatagan.lang
/**
* Marker interface for all framework (builtin) annotations.
*
* These are modeled separately from [Annotated] API, as some implementation may optimize working with _known_
* annotation classes and/or handle their names in a specific way.
*/
public sealed interface BuiltinAnnotation{
/**
* A marker interface for builtin annotation class.
* All direct sub-interfaces denote a specific annotation target.
*/
public sealed interface Target {
public val modelClass: Class
public sealed interface OnMethod : Target
public sealed interface OnMethodRepeatable : Target
public sealed interface OnConstructor : Target
public sealed interface OnClass : Target
public sealed interface OnClassRepeatable : Target
public sealed interface OnAnnotationClass : Target
public sealed interface OnParameter : Target
public sealed interface OnField : Target
public sealed interface CanBeCastedOut : Target
}
public sealed interface OnMethod : BuiltinAnnotation
public sealed interface OnMethodRepeatable : BuiltinAnnotation
public sealed interface OnConstructor : BuiltinAnnotation
public sealed interface OnClass : BuiltinAnnotation
public sealed interface OnClassRepeatable : BuiltinAnnotation
public sealed interface OnAnnotationClass : BuiltinAnnotation
public sealed interface OnParameter : BuiltinAnnotation
public sealed interface OnField : BuiltinAnnotation
public sealed interface CanBeCastedOut : BuiltinAnnotation
/**
* Represents `javax.inject.Inject`.
*/
public object Inject :
OnConstructor, Target.OnConstructor,
OnMethod, Target.OnMethod,
OnField, Target.OnField {
override val modelClass: Class get() = Inject::class.java
}
/**
* Represents `javax.inject.Scope`.
*/
public object Scope : OnAnnotationClass, Target.OnAnnotationClass {
override val modelClass: Class get() = Scope::class.java
}
/**
* Represents `javax.inject.Qualifier`.
*/
public object Qualifier : OnAnnotationClass, Target.OnAnnotationClass {
override val modelClass: Class get() = Qualifier::class.java
}
/**
* Models `com.yandex.yatagan.Module` annotation.
*/
public interface Module : OnClass {
public val includes: List
public val subcomponents: List
public companion object : Target.OnClass {
override val modelClass: Class get() = Module::class.java
}
}
/**
* Models `com.yandex.yatagan.Binds` annotation.
*/
public object Binds : OnMethod, Target.OnMethod {
override val modelClass: Class get() = Binds::class.java
}
/**
* Models `com.yandex.yatagan.Provides` annotation.
*/
public interface Provides : OnMethod {
public val conditionals: List
public companion object : Target.OnMethod {
override val modelClass: Class get() = Provides::class.java
}
}
/**
* Models `com.yandex.yatagan.Component` annotation.
*/
public interface Component : OnClass {
public val isRoot: Boolean
public val modules: List
public val dependencies: List
public val variant: List
public val multiThreadAccess: Boolean
/**
* Models `com.yandex.yatagan.Component.Builder` annotation.
*/
public object Builder : OnClass, Target.OnClass {
override val modelClass: Class get() = Builder::class.java
}
public companion object : Target.OnClass {
override val modelClass: Class get() = Component::class.java
}
}
/**
* Models `com.yandex.yatagan.BindsInstance` annotation.
*/
public object BindsInstance :
OnMethod, Target.OnMethod,
OnParameter, Target.OnParameter {
override val modelClass: Class get() = BindsInstance::class.java
}
public sealed interface ConditionFamily : OnClassRepeatable {
/**
* Represents `com.yandex.yatagan.Condition` annotation.
*/
public interface One : ConditionFamily {
public val target: Type
public val condition: String
}
/**
* Represents `com.yandex.yatagan.AnyCondition` annotation.
*/
public interface Any : ConditionFamily {
public val conditions: List
}
public companion object : Target.OnClassRepeatable {
override val modelClass: Class get() = ConditionFamily::class.java
}
}
/**
* Represents `com.yandex.yatagan.ConditionExpression` annotation.
*/
public interface ConditionExpression : OnClass {
public val value: String
public val imports: List
public val importAs: List
public interface ImportAs {
public val value: Type
public val alias: String
}
public companion object : Target.OnClass {
override val modelClass: Class get() = ConditionExpression::class.java
}
}
/**
* Represents `com.yandex.yatagan.Conditional` annotation.
*/
public interface Conditional : OnClassRepeatable {
public val featureTypes: List
public val onlyIn: List
public companion object : Target.OnClassRepeatable {
override val modelClass: Class get() = Conditional::class.java
}
}
/**
* Represents `com.yandex.yatagan.ComponentVariantDimension` annotation.
*/
public object ComponentVariantDimension : OnClass, Target.OnClass {
override val modelClass: Class get() = ComponentVariantDimension::class.java
}
/**
* Represents `com.yandex.yatagan.ComponentFlavor` annotation.
*/
public interface ComponentFlavor : OnClass {
public val dimension: Type
public companion object : Target.OnClass {
override val modelClass: Class get() = ComponentFlavor::class.java
}
}
/**
* Represents `com.yandex.yatagan.AssistedInject` annotation.
*/
public object AssistedInject : OnConstructor, Target.OnConstructor {
override val modelClass: Class get() = AssistedInject::class.java
}
/**
* `com.yandex.yatagan.Assisted` annotation model.
*/
public interface Assisted : OnParameter {
public val value: String
public companion object : Target.OnParameter {
override val modelClass: Class get() = Assisted::class.java
}
}
/**
* Represents `com.yandex.yatagan.AssistedFactory` annotation.
*/
public object AssistedFactory : OnClass, Target.OnClass {
override val modelClass: Class get() = AssistedFactory::class.java
}
/**
* Represents `com.yandex.yatagan.Multibinds` annotation.
*/
public object Multibinds : OnMethod, Target.OnMethod {
override val modelClass: Class get() = Multibinds::class.java
}
public sealed interface IntoCollectionFamily : OnMethodRepeatable {
public val flatten: Boolean
/**
* Models `com.yandex.yatagan.IntoList` annotations.
*/
public interface IntoList : IntoCollectionFamily
/**
* Models `com.yandex.yatagan.IntoSet` annotations.
*/
public interface IntoSet : IntoCollectionFamily
public companion object : Target.OnMethodRepeatable {
override val modelClass: Class get() = IntoCollectionFamily::class.java
}
}
/**
* Represents `com.yandex.yatagan.IntoMap` annotation.
*/
public object IntoMap : OnMethod, Target.OnMethod {
override val modelClass: Class get() = IntoMap::class.java
/**
* Represents `com.yandex.yatagan.IntoMap.Key` annotation.
*/
public object Key : OnAnnotationClass, Target.OnAnnotationClass {
override val modelClass: Class get() = Key::class.java
}
}
public interface ValueOf : CanBeCastedOut {
public val value: ConditionExpression
public companion object : Target.CanBeCastedOut {
override val modelClass: Class get() = ValueOf::class.java
}
}
}