![JAR search and dependency download from the Maven repository](/logo.png)
com.frameworkx.annotation.Adaptive Maven / Gradle / Ivy
/*
* Copyright 1999-2011 Alibaba Group.
*
* 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.frameworkx.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.net.URL;
import com.google.inject.BindingAnnotation;
/**
* 在{@link ExtensionLoader}生成Extension的Adaptive Instance时,为{@link ExtensionLoader}提供信息。
*
* @author ding.lid
* @export
*
* @see ExtensionLoader
* @see URL
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
@BindingAnnotation
public @interface Adaptive {
/**
* 从{@link URL}的Key名,对应的Value作为要Adapt成的Extension名。
*
* 如果{@link URL}这些Key都没有Value,使用 用 缺省的扩展(在接口的{@link SPI}中设定的值)。
* 比如,String[] {"key1", "key2"}
,表示
*
* - 先在URL上找key1的Value作为要Adapt成的Extension名;
*
- key1没有Value,则使用key2的Value作为要Adapt成的Extension名。
*
- key2没有Value,使用缺省的扩展。
*
- 如果没有设定缺省扩展,则方法调用会抛出{@link IllegalStateException}。
*
*
* 如果不设置则缺省使用Extension接口类名的点分隔小写字串。
* 即对于Extension接口{@code com.alibaba.dubbo.xxx.YyyInvokerWrapper}的缺省值为String[] {"yyy.invoker.wrapper"}
*
* @see SPI#value()
*/
String[] value() default {};
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy