Search in sources :

Example 1 with CompositeServiceInfo

use of org.springframework.cloud.service.CompositeServiceInfo in project spring-cloud-connectors by spring-cloud.

the class ServiceConnectorCreatorRegistry method flatten.

private static List<ServiceInfo> flatten(List<ServiceInfo> serviceInfos) {
    List<ServiceInfo> flattened = new ArrayList<ServiceInfo>();
    for (ServiceInfo serviceInfo : serviceInfos) {
        if (serviceInfo instanceof CompositeServiceInfo) {
            // recursively flatten any CompositeServiceInfos
            CompositeServiceInfo compositeServiceInfo = (CompositeServiceInfo) serviceInfo;
            flattened.addAll(flatten(compositeServiceInfo.getServiceInfos()));
        } else {
            flattened.add(serviceInfo);
        }
    }
    return flattened;
}
Also used : ServiceInfo(org.springframework.cloud.service.ServiceInfo) CompositeServiceInfo(org.springframework.cloud.service.CompositeServiceInfo) CompositeServiceInfo(org.springframework.cloud.service.CompositeServiceInfo) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 CompositeServiceInfo (org.springframework.cloud.service.CompositeServiceInfo)1 ServiceInfo (org.springframework.cloud.service.ServiceInfo)1