/** * Extracts the service id from the passed annotated element. First the {@link ServiceId} annotation is checked. * If present, its value is returned. Otherwise {@link Named} annotation is checked. If present, its value is * returned. * If neither of the annotations is present, <code>null</code> value is returned * * @param annotated * annotated element to get annotations from * @since 5.3 */ public static String getServiceId(AnnotatedElement annotated) { ServiceId serviceIdAnnotation = annotated.getAnnotation(ServiceId.class); if (serviceIdAnnotation != null) { return serviceIdAnnotation.value(); } Named namedAnnotation = annotated.getAnnotation(Named.class); if (namedAnnotation != null) { String value = namedAnnotation.value(); if (InternalCommonsUtils.isNonBlank(value)) { return value; } } return null; }
/** * Extracts the service id from the passed annotated element. First the {@link ServiceId} annotation is checked. * If present, its value is returned. Otherwise {@link Named} annotation is checked. If present, its value is * returned. * If neither of the annotations is present, <code>null</code> value is returned * * @param annotated * annotated element to get annotations from * @since 5.3 */ public static String getServiceId(AnnotatedElement annotated) { ServiceId serviceIdAnnotation = annotated.getAnnotation(ServiceId.class); if (serviceIdAnnotation != null) { return serviceIdAnnotation.value(); } Named namedAnnotation = annotated.getAnnotation(Named.class); if (namedAnnotation != null) { String value = namedAnnotation.value(); if (InternalCommonsUtils.isNonBlank(value)) { return value; } } return null; }