@Test public void testBuiltinMappers() throws MalformedURLException, ParseException { assertMapper("13", Byte.class, (byte) 13); assertMapper("13", Byte.TYPE, (byte) 13); assertMapper("13", byte.class, (byte) 13); assertMapper("-13", Short.class, (short) -13); assertMapper("-13", Short.TYPE, (short) -13); assertMapper("-13", short.class, (short) -13); assertMapper("2147483647", Integer.class, 2147483647); assertMapper("2147483647", Integer.TYPE, 2147483647); assertMapper("2147483647", int.class, 2147483647); assertMapper("9223372036854775807", Long.class, 9223372036854775807L); assertMapper("9223372036854775807", Long.TYPE, 9223372036854775807L); assertMapper("9223372036854775807", long.class, 9223372036854775807L); assertMapper("1234.5678", Float.class, 1234.5678f); assertMapper("1234.5678", Float.TYPE, 1234.5678f); assertMapper("1234.5678", float.class, 1234.5678f); assertMapper("1234.5678", Double.class, 1234.5678); assertMapper("1234.5678", Double.TYPE, 1234.5678); assertMapper("1234.5678", double.class, 1234.5678); assertMapper("true", Boolean.class, true); assertMapper("true", Boolean.TYPE, true); assertMapper("true", boolean.class, true); assertMapper("L", Character.class, 'L'); assertMapper("L", Character.TYPE, 'L'); assertMapper("L", char.class, 'L'); assertMapper(this.getClass().getName(), Class.class, this.getClass()); assertMapper(this.getClass().getName(), Class.class, this.getClass()); assertMapper("922337203.6854775807", BigDecimal.class, new BigDecimal("922337203.6854775807")); assertMapper("9223372036854775807", BigInteger.class, new BigInteger("9223372036854775807")); assertMapper("PT10H", Duration.class, Duration.ofHours(10)); assertMapper("2017-03-14", LocalDate.class, LocalDate.of(2017, Month.MARCH, 14)); assertMapper("2017-03-14T17:04", LocalDateTime.class, LocalDateTime.of(2017, Month.MARCH, 14, 17, 4)); assertMapper("17:04", LocalTime.class, LocalTime.of(17, 4)); assertMapper("2017-03-14T17:04+01:00[Europe/Prague]", ZonedDateTime.class, ZonedDateTime.of(LocalDateTime.of(2017, Month.MARCH, 14, 17, 4), ZoneId.of("Europe/Prague"))); assertMapper("Europe/Prague", ZoneId.class, ZoneId.of("Europe/Prague")); assertMapper("2007-12-03T10:15:30.00Z", Instant.class, Instant.ofEpochSecond(1196676930)); assertMapper("17:04+01:00", OffsetTime.class, OffsetTime.of(17, 4, 0, 0, ZoneOffset.ofHours(1))); assertMapper("2017-03-14T17:04+01:00", OffsetDateTime.class, OffsetDateTime.of(2017, 3, 14, 17, 4, 0, 0, ZoneOffset.ofHours(1))); assertMapper("P-3Y-4D", Period.class, Period.of(-3, 0, -4)); assertMapper("+0100", ZoneOffset.class, ZoneOffset.of("+0100")); assertMapper("/tmp/myfile.txt", File.class, new File("/tmp/myfile.txt")); assertMapper("/tmp/myfile.txt", Path.class, Paths.get("/tmp/myfile.txt")); assertMapper("ISO-8859-2", Charset.class, Charset.forName("iso-8859-2")); assertMapper("mailto:java-net@java.sun.com", URI.class, URI.create("mailto:java-net@java.sun.com")); assertMapper("http: assertMapper("0b6a4e86-0955-11e7-93ae-92361f002671", UUID.class, UUID.fromString("0b6a4e86-0955-11e7-93ae-92361f002671")); assertMapper("2011-12-03T10:15:30+01:00", Date.class, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").parse("2011-12-03T10:15:30+0100")); GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").parse("2011-12-03T10:15:30+0100")); assertMapper("2011-12-03T10:15:30+01:00", Calendar.class, calendar); assertMapper("2011-12-03T10:15:30+01:00", GregorianCalendar.class, calendar); assertMapper("Europe/Prague", TimeZone.class, TimeZone.getTimeZone(ZoneId.of("Europe/Prague"))); assertMapper("Europe/Prague", SimpleTimeZone.class, new SimpleTimeZone(3_600_000, "Europe/Prague")); }
static Map<Class<?>, Function<Config, ?>> builtInMappers() { return BUILT_IN_MAPPERS; }
ConfigMappers { static Map<Class<?>, Function<Config, ?>> builtInMappers() { return BUILT_IN_MAPPERS; } }
ConfigMappers { static Map<Class<?>, Function<Config, ?>> builtInMappers() { return BUILT_IN_MAPPERS; } private  ConfigMappers(); }
ConfigMappers { static Map<Class<?>, Function<Config, ?>> builtInMappers() { return BUILT_IN_MAPPERS; } private  ConfigMappers(); static Byte toByte(String stringValue); static Short toShort(String stringValue); static Integer toInt(String stringValue); static Long toLong(String stringValue); static Float toFloat(String stringValue); static Double toDouble(String stringValue); static Boolean toBoolean(String stringValue); static Character toChar(String stringValue); static Class<?> toClass(String stringValue); static UUID toUUID(String stringValue); static BigDecimal toBigDecimal(String stringValue); static BigInteger toBigInteger(String stringValue); static File toFile(String stringValue); static Path toPath(String stringValue); static Charset toCharset(String stringValue); static Pattern toPattern(String stringValue); static URI toUri(String stringValue); static URL toUrl(String stringValue); @SuppressWarnings({"UseOfObsoleteDateTimeApi", "DeprecatedIsStillUsed"}) @Deprecated static Date toDate(String stringValue); @SuppressWarnings({"UseOfObsoleteDateTimeApi", "DeprecatedIsStillUsed"}) @Deprecated static Calendar toCalendar(String stringValue); @SuppressWarnings({"UseOfObsoleteDateTimeApi", "DeprecatedIsStillUsed"}) @Deprecated static GregorianCalendar toGregorianCalendar(String stringValue); static LocalDate toLocalDate(String stringValue); static LocalTime toLocalTime(String stringValue); static LocalDateTime toLocalDateTime(String stringValue); static ZonedDateTime toZonedDateTime(String stringValue); static ZoneId toZoneId(String stringValue); static ZoneOffset toZoneOffset(String stringValue); @SuppressWarnings({"UseOfObsoleteDateTimeApi", "DeprecatedIsStillUsed"}) @Deprecated static TimeZone toTimeZone(String stringValue); @SuppressWarnings({"UseOfObsoleteDateTimeApi", "DeprecatedIsStillUsed"}) @Deprecated static SimpleTimeZone toSimpleTimeZone(String stringValue); static Instant toInstant(String stringValue); static OffsetDateTime toOffsetDateTime(String stringValue); static OffsetTime toOffsetTime(String stringValue); static Duration toDuration(String stringValue); static Period toPeriod(String stringValue); static Map<String, String> toMap(Config config); static Properties toProperties(Config config); }
ConfigMappers { static Map<Class<?>, Function<Config, ?>> builtInMappers() { return BUILT_IN_MAPPERS; } private  ConfigMappers(); static Byte toByte(String stringValue); static Short toShort(String stringValue); static Integer toInt(String stringValue); static Long toLong(String stringValue); static Float toFloat(String stringValue); static Double toDouble(String stringValue); static Boolean toBoolean(String stringValue); static Character toChar(String stringValue); static Class<?> toClass(String stringValue); static UUID toUUID(String stringValue); static BigDecimal toBigDecimal(String stringValue); static BigInteger toBigInteger(String stringValue); static File toFile(String stringValue); static Path toPath(String stringValue); static Charset toCharset(String stringValue); static Pattern toPattern(String stringValue); static URI toUri(String stringValue); static URL toUrl(String stringValue); @SuppressWarnings({"UseOfObsoleteDateTimeApi", "DeprecatedIsStillUsed"}) @Deprecated static Date toDate(String stringValue); @SuppressWarnings({"UseOfObsoleteDateTimeApi", "DeprecatedIsStillUsed"}) @Deprecated static Calendar toCalendar(String stringValue); @SuppressWarnings({"UseOfObsoleteDateTimeApi", "DeprecatedIsStillUsed"}) @Deprecated static GregorianCalendar toGregorianCalendar(String stringValue); static LocalDate toLocalDate(String stringValue); static LocalTime toLocalTime(String stringValue); static LocalDateTime toLocalDateTime(String stringValue); static ZonedDateTime toZonedDateTime(String stringValue); static ZoneId toZoneId(String stringValue); static ZoneOffset toZoneOffset(String stringValue); @SuppressWarnings({"UseOfObsoleteDateTimeApi", "DeprecatedIsStillUsed"}) @Deprecated static TimeZone toTimeZone(String stringValue); @SuppressWarnings({"UseOfObsoleteDateTimeApi", "DeprecatedIsStillUsed"}) @Deprecated static SimpleTimeZone toSimpleTimeZone(String stringValue); static Instant toInstant(String stringValue); static OffsetDateTime toOffsetDateTime(String stringValue); static OffsetTime toOffsetTime(String stringValue); static Duration toDuration(String stringValue); static Period toPeriod(String stringValue); static Map<String, String> toMap(Config config); static Properties toProperties(Config config);  }