Component container add tools to specify default implementation of a component

This commit is contained in:
Pavel V. Talanov
2017-03-02 13:32:23 +03:00
parent 8bd23d71a7
commit 2b373a3601
7 changed files with 112 additions and 10 deletions
@@ -0,0 +1,25 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* 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 org.jetbrains.kotlin.container
import kotlin.reflect.KClass
/*Use to assist injection to provide a default implementation for a certain component and reduce boilerplate in injector code.
* Argument class must be a non-abstract component class or a kotlin object implementing target interface.
* Avoid using when there is no clear 'default' behaviour for a component.
* */
annotation class DefaultImplementation(val impl: KClass<*>)