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)); } }
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); } }
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);