| Total Complexity | 2 | 
| Total Lines | 15 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | package de.pewpewproject.lasertag.common.util; | ||
| 8 | public class ConverterUtil { | ||
| 9 | /** | ||
| 10 | * Converts a string to the correct primitive type. | ||
| 11 | * Currently only supports long and boolean | ||
| 12 | * @param value The string to convert | ||
| 13 | * @return The converted primitive type | ||
| 14 | */ | ||
| 15 |     public static Object stringToPrimitiveType(String value) { | ||
| 16 | // Try to convert to int | ||
| 17 |         try { | ||
| 18 | return Long.parseLong(value); | ||
| 19 |         } catch (NumberFormatException ignored) {} | ||
| 20 | |||
| 21 | // Convert to boolean | ||
| 22 | return Boolean.parseBoolean(value); | ||
| 23 | } | ||
| 25 |