| 1 | /*- | |
| 2 | * #%L | |
| 3 | * io.earcam.utilitarian.site.search.offline | |
| 4 | * %% | |
| 5 | * Copyright (C) 2017 earcam | |
| 6 | * %% | |
| 7 | * SPDX-License-Identifier: (BSD-3-Clause OR EPL-1.0 OR Apache-2.0 OR MIT) | |
| 8 | * | |
| 9 | * You <b>must</b> choose to accept, in full - any individual or combination of | |
| 10 | * the following licenses: | |
| 11 | * <ul> | |
| 12 | * <li><a href="https://opensource.org/licenses/BSD-3-Clause">BSD-3-Clause</a></li> | |
| 13 | * <li><a href="https://www.eclipse.org/legal/epl-v10.html">EPL-1.0</a></li> | |
| 14 | * <li><a href="https://www.apache.org/licenses/LICENSE-2.0">Apache-2.0</a></li> | |
| 15 | * <li><a href="https://opensource.org/licenses/MIT">MIT</a></li> | |
| 16 | * </ul> | |
| 17 | * #L% | |
| 18 | */ | |
| 19 | package io.earcam.utilitarian.site.search.offline; | |
| 20 | ||
| 21 | import java.nio.charset.Charset; | |
| 22 | import java.util.Map; | |
| 23 | ||
| 24 | public interface Component { | |
| 25 | ||
| 26 | public default String id() | |
| 27 | { | |
| 28 |
1
1. id : mutated return of Object value for io/earcam/utilitarian/site/search/offline/Component::id to ( if (x != null) null else throw new RuntimeException ) → KILLED |
return this.getClass().getSimpleName(); |
| 29 | } | |
| 30 | ||
| 31 | ||
| 32 | public default void configure(Map<String, String> configuration) | |
| 33 | {} | |
| 34 | ||
| 35 | ||
| 36 | public static String mandatory(Map<String, String> configuration, String key) | |
| 37 | { | |
| 38 |
1
1. mandatory : negated conditional → KILLED |
if(configuration.containsKey(key)) { |
| 39 |
1
1. mandatory : mutated return of Object value for io/earcam/utilitarian/site/search/offline/Component::mandatory to ( if (x != null) null else throw new RuntimeException ) → KILLED |
return configuration.get(key); |
| 40 | } | |
| 41 | throw new NullPointerException("Missing mandatory configuration: " + key); | |
| 42 | } | |
| 43 | ||
| 44 | ||
| 45 | public static boolean getOrDefault(Map<String, String> configuration, String key, boolean defaultValue) | |
| 46 | { | |
| 47 |
1
1. getOrDefault : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED |
return Boolean.parseBoolean(configuration.getOrDefault(key, Boolean.toString(defaultValue))); |
| 48 | } | |
| 49 | ||
| 50 | ||
| 51 | public static Charset getOrDefault(Map<String, String> configuration, String key, Charset defaultValue) | |
| 52 | { | |
| 53 |
1
1. getOrDefault : mutated return of Object value for io/earcam/utilitarian/site/search/offline/Component::getOrDefault to ( if (x != null) null else throw new RuntimeException ) → KILLED |
return Charset.forName(configuration.getOrDefault(key, defaultValue.toString())); |
| 54 | } | |
| 55 | } | |
Mutations | ||
| 28 |
1.1 |
|
| 38 |
1.1 |
|
| 39 |
1.1 |
|
| 47 |
1.1 |
|
| 53 |
1.1 |