INNER CODE UNIT · Java
serviceMethods
scalecube/scalecube-services · services-api/src/main/java/io/scalecube/services/Reflect.java:241
public static Collection<Method> serviceMethods(Class<?> serviceInterface) {
return Arrays.stream(serviceInterface.getMethods())
.filter(method -> method.isAnnotationPresent(ServiceMethod.class))
.toList();
}
/**
* Gets service interfaces collections from service instance.
*
* @param serviceObject serviceObject that implements service interface with {@link Service}
* annotation
* @return service interface class
*/
public static Stream<Class<?>> serviceInterfaces(Object serviceObject) {
Class<?> current = serviceObject.getClass();
Set<Class<?>> interfaces = new HashSet<>();
while (current != Object.class) {
interfaces.addAll(Arrays.asList(current.getInterfaces()));