org.oasisopen.sca.annotation.Service.names()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(75)

本文整理了Java中org.oasisopen.sca.annotation.Service.names()方法的一些代码示例,展示了Service.names()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Service.names()方法的具体详情如下:
包路径:org.oasisopen.sca.annotation.Service
类名称:Service
方法名:names

Service.names介绍

暂无

代码示例

代码示例来源:origin: com.carecon.fabric3/fabric3-introspection-java

public void visitType(org.oasisopen.sca.annotation.Service annotation, Class<?> type, InjectingComponentType componentType, IntrospectionContext context) {
  Class<?>[] services = annotation.value();
  String[] names = annotation.names();
  for (int i = 0; i < services.length; i++) {
    Class<?> service = services[i];
    componentType.add(createDefinition(service, names.length == 0 ? service.getSimpleName() : names[i], type, componentType, context));
  }
}

代码示例来源:origin: org.codehaus.fabric3/fabric3-introspection-java

public void visitType(Service annotation, Class<?> type, InjectingComponentType componentType, IntrospectionContext context) {
  for (Class<?> service : annotation.names()) {
    ServiceDefinition definition = createDefinition(service, type, componentType, context);
    componentType.add(definition);
  }
  Class<?> service = annotation.value();
  if (!Void.class.equals(service)) {
    ServiceDefinition definition = createDefinition(service, type, componentType, context);
    componentType.add(definition);
  }
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

if (annotation.names().length > 0) {
  if (annotation.names().length != interfaces.length) {
    throw new IntrospectionException("[JCA90050] The number of Strings in the names attribute array of the @Service annotation MUST match the number of elements in the value attribute array");
  names.addAll(Arrays.asList(annotation.names()));
  if (names.size() != annotation.names().length) {
    throw new IntrospectionException("[JCA90060] The value of each element in the @Service names array MUST be unique amongst all the other element values in the array");
    String name = (annotation.names().length > 0) ? annotation.names()[i] : null;
    Service service = createService(clazz, interfaces[i], name);
    type.getServices().add(service);

相关文章

微信公众号

最新文章

更多