INNER CODE UNIT · Java
transformArrayToMap
scalecube/scalecube-services · services-api/src/main/java/io/scalecube/services/Reflect.java:228
private static Map<String, String> transformArrayToMap(Tag[] array) {
return array == null || array.length == 0
? Collections.emptyMap()
: Collections.unmodifiableMap(
Arrays.stream(array).collect(Collectors.toMap(Tag::key, Tag::value)));
}
/**
* Gets service method map from service api.
*
* @param serviceInterface with {@link Service} annotation
* @return service name
*/
public static Collection<Method> serviceMethods(Class<?> serviceInterface) {
return Arrays.stream(serviceInterface.getMethods())
.filter(method -> method.isAnnotationPresent(ServiceMethod.class))
.toList();
}