Search in sources :

Example 1 with Method

use of org.apache.dubbo.config.annotation.Method in project dubbo by alibaba.

the class ReferenceBeanBuilder method configureMethodConfig.

void configureMethodConfig(AnnotationAttributes attributes, ReferenceBean<?> referenceBean) {
    Method[] methods = (Method[]) attributes.get("methods");
    List<MethodConfig> methodConfigs = MethodConfig.constructMethodConfig(methods);
    for (MethodConfig methodConfig : methodConfigs) {
        if (!StringUtils.isEmpty(methodConfig.getOninvoke())) {
            Object invokeRef = this.applicationContext.getBean((String) methodConfig.getOninvoke());
            methodConfig.setOninvoke(invokeRef);
        }
        if (!StringUtils.isEmpty(methodConfig.getOnreturn())) {
            Object returnRef = this.applicationContext.getBean((String) methodConfig.getOnreturn());
            methodConfig.setOnreturn(returnRef);
        }
        if (!StringUtils.isEmpty(methodConfig.getOnthrow())) {
            Object throwRef = this.applicationContext.getBean((String) methodConfig.getOnthrow());
            methodConfig.setOnthrow(throwRef);
        }
    }
    if (!methodConfigs.isEmpty()) {
        referenceBean.setMethods(methodConfigs);
    }
}
Also used : MethodConfig(org.apache.dubbo.config.MethodConfig) Method(org.apache.dubbo.config.annotation.Method)

Aggregations

MethodConfig (org.apache.dubbo.config.MethodConfig)1 Method (org.apache.dubbo.config.annotation.Method)1