Package: TicTacToeDefaultStrategyFactoryProvider
TicTacToeDefaultStrategyFactoryProvider
| name | instruction | branch | complexity | line | method | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| TicTacToeDefaultStrategyFactoryProvider() | 
  | 
  | 
  | 
  | 
  | 
||||||||||||||||||||
| getStrategyFactories() | 
  | 
  | 
  | 
  | 
  | 
||||||||||||||||||||
Coverage
1: /*
2:  * Copyright © 2021-2023 Fachhochschule für die Wirtschaft (FHDW) Hannover
3:  *
4:  * This file is part of ipspiel24-tictactoe-core.
5:  *
6:  * ipspiel24-tictactoe-core is free software: you can redistribute it and/or modify it under
7:  * the terms of the GNU General Public License as published by the Free Software
8:  * Foundation, either version 3 of the License, or (at your option) any later
9:  * version.
10:  *
11:  * ipspiel24-tictactoe-core is distributed in the hope that it will be useful, but WITHOUT
12:  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13:  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14:  * details.
15:  *
16:  * You should have received a copy of the GNU General Public License along with
17:  * ipspiel24-tictactoe-core. If not, see <http://www.gnu.org/licenses/>.
18:  */
19: package de.fhdw.gaming.ipspiel24.tictactoe.core.domain.factory;
20: 
21: import java.util.ArrayList;
22: import java.util.List;
23: import java.util.ServiceLoader;
24: 
25: /**
26:  * Implements {@link TicTacToeStrategyFactoryProvider} by using the {@link ServiceLoader}.
27:  */
28: public final class TicTacToeDefaultStrategyFactoryProvider implements TicTacToeStrategyFactoryProvider {
29: 
30:     @Override
31:     public List<TicTacToeStrategyFactory> getStrategyFactories() {
32:         final ServiceLoader<TicTacToeStrategyFactory> services = ServiceLoader.load(TicTacToeStrategyFactory.class);
33:         final List<TicTacToeStrategyFactory> list = new ArrayList<>();
34:         services.iterator().forEachRemaining(list::add);
35:         return list;
36:     }
37: }