Skip to content

Package: InputProviderFactory

InputProviderFactory

nameinstructionbranchcomplexitylinemethod
getInstances()
M: 17 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * Copyright © 2020-2023 Fachhochschule für die Wirtschaft (FHDW) Hannover
3: *
4: * This file is part of gaming-core.
5: *
6: * Gaming-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: * Gaming-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: * gaming-core. If not, see <http://www.gnu.org/licenses/>.
18: */
19: package de.fhdw.gaming.core.ui;
20:
21: import java.util.ArrayList;
22: import java.util.List;
23: import java.util.ServiceLoader;
24:
25: /**
26: * Allows to create an {@link InputProvider}..
27: */
28: public interface InputProviderFactory {
29:
30: /**
31: * Creates an {@link InputProvider} object.
32: */
33: InputProvider createInputProvider();
34:
35: /**
36: * Returns all available observer factories.
37: */
38: static List<InputProviderFactory> getInstances() {
39: final ServiceLoader<InputProviderFactory> services = ServiceLoader.load(InputProviderFactory.class);
40: final List<InputProviderFactory> list = new ArrayList<>();
41: services.iterator().forEachRemaining(list::add);
42: return list;
43: }
44: }