use of io.joynr.ProvidedBy in project joynr by bmwcarit.
the class DefaultJoynrRuntimeFactory method getInterfaceName.
private String getInterfaceName(Class<?> providerInterfaceClass) {
try {
ProvidedBy providedBy = providerInterfaceClass.getAnnotation(ProvidedBy.class);
JoynrInterface joynrInterface = providedBy.value().getAnnotation(JoynrInterface.class);
return joynrInterface.name();
} catch (SecurityException | IllegalArgumentException e) {
LOG.debug("error getting interface details", e);
return providerInterfaceClass.getSimpleName();
}
}
use of io.joynr.ProvidedBy in project joynr by bmwcarit.
the class ParticipantIdKeyUtil method getProviderParticipantIdKey.
public static String getProviderParticipantIdKey(String domain, Class interfaceClass) {
Class annotatedInterface;
if (interfaceClass.getAnnotation(ProvidedBy.class) != null) {
annotatedInterface = ((ProvidedBy) interfaceClass.getAnnotation(ProvidedBy.class)).value();
} else {
annotatedInterface = interfaceClass;
}
JoynrInterface joynrInterface = (JoynrInterface) annotatedInterface.getAnnotation(JoynrInterface.class);
if (joynrInterface == null) {
throw new JoynrIllegalStateException("Class " + annotatedInterface + " not annotated with @JoynrInterface. Can't get interface name.");
}
String interfaceName = joynrInterface.name();
return getProviderParticipantIdKey(domain, interfaceName);
}
use of io.joynr.ProvidedBy in project joynr by bmwcarit.
the class ServiceProviderDiscovery method findServiceProviderBeans.
@SuppressWarnings("serial")
public Set<Bean<?>> findServiceProviderBeans() {
Set<Bean<?>> result = new HashSet<>();
for (Bean<?> bean : beanManager.getBeans(Object.class, new AnnotationLiteral<Any>() {
})) {
ServiceProvider serviceProvider = bean.getBeanClass().getAnnotation(ServiceProvider.class);
if (serviceProvider != null) {
ProvidedBy providedBy = getProvidedByAnnotation(serviceProvider.serviceInterface());
verifyProvidedBy(providedBy, serviceProvider.serviceInterface(), bean);
result.add(bean);
if (LOG.isTraceEnabled()) {
LOG.trace(format("Bean %s is a service provider. Adding to result.", bean));
}
} else if (LOG.isTraceEnabled()) {
LOG.trace(format("Ignoring bean: %s", bean));
}
}
if (LOG.isDebugEnabled()) {
LOG.debug(format("Found the following service provider beans:%n%s", result));
}
return result;
}
Aggregations