SierraSystems/ntt-data-notification-service

View on GitHub
src/main/java/com/nttdata/nttdatanotificationservice/service/ChannelServiceFactory.java

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
package com.nttdata.nttdatanotificationservice.service;

import java.util.List;
import java.util.Optional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ChannelServiceFactory {

  @Autowired
  List<ChannelService> channelServices;

  public Optional<ChannelService> getChanelService(ChatApp chatApp) {
    return channelServices.stream().filter(x -> x.getChatApp() == chatApp).findFirst();
  }
}