public interface IProperties
| 限定符和类型 | 方法和说明 |
|---|---|
default Boolean |
getBoolean(String key) |
default Boolean |
getBoolean(String key,
Boolean defaultVal) |
default java.time.Duration |
getBoolean(String key,
java.time.Duration defaultVal) |
default java.time.Duration |
getDuration(String key) |
default java.time.Duration |
getDuration(String key,
java.time.Duration defaultVal)
Examples:
"PT20.345S" -- parses as "20.345 seconds"
"PT15M" -- parses as "15 minutes" (where a minute is 60 seconds)
"PT10H" -- parses as "10 hours" (where an hour is 3600 seconds)
"P2D" -- parses as "2 days" (where a day is 24 hours or 86400 seconds)
"P2DT3H4M" -- parses as "2 days, 3 hours and 4 minutes"
"P-6H3M" -- parses as "-6 hours and +3 minutes"
"-P6H3M" -- parses as "-6 hours and -3 minutes"
"-P-6H+3M" -- parses as "+6 hours and -3 minutes"
|
default int |
getInt(String key) |
default int |
getInt(String key,
int defaultVal) |
default Integer |
getInteger(String key) |
default Integer |
getInteger(String key,
Integer defaultVal) |
default List<Integer> |
getIntegers(String key) |
default java.time.LocalDate |
getLocalDate(String key,
java.time.LocalDate defaultVal) |
default java.time.LocalDateTime |
getLocalDateTime(String key) |
default java.time.LocalDateTime |
getLocalDateTime(String key,
java.time.LocalDateTime defaultVal)
2007-12-03T10:15:30
|
default java.time.LocalTime |
getLocalTime(String key,
java.time.LocalTime defaultVal) |
default Long |
getLong(String key) |
default Long |
getLong(String key,
Long defaultVal) |
default List<Long> |
getLongs(String key) |
default <T> T |
getObject(String key,
T defaultVal,
java.util.function.Function<String,T> func) |
default <T> List<T> |
getObjects(String key,
T defaultVal,
java.util.function.Function<String,T> converter) |
default java.time.OffsetDateTime |
getOffsetDateTime(String key,
java.time.OffsetDateTime defaultVal)
2007-12-03T10:15:30+01:00
|
String |
getString(String key) |
default String |
getString(String key,
String defaultVal) |
static IProperties |
of(java.util.function.Function<String,String> mapper) |
static IProperties |
of(Map<String,String> map) |
static IProperties |
of(Path propertiesFile) |
static IProperties |
of(Path propertiesFile,
java.util.function.Consumer<Throwable> exceptionHandler) |
static IProperties |
of(Properties prop) |
static IProperties |
of(URI uri) |
static IProperties of(java.util.function.Function<String,String> mapper)
static IProperties of(Map<String,String> map)
static IProperties of(URI uri)
static IProperties of(Properties prop)
static IProperties of(Path propertiesFile) throws IOException
IOExceptionstatic IProperties of(Path propertiesFile, java.util.function.Consumer<Throwable> exceptionHandler)
default int getInt(String key)
default int getInt(String key, int defaultVal)
default java.time.Duration getDuration(String key)
default java.time.Duration getBoolean(String key, java.time.Duration defaultVal)
default <T> List<T> getObjects(String key, T defaultVal, java.util.function.Function<String,T> converter)
default java.time.Duration getDuration(String key, java.time.Duration defaultVal)
Examples: "PT20.345S" -- parses as "20.345 seconds" "PT15M" -- parses as "15 minutes" (where a minute is 60 seconds) "PT10H" -- parses as "10 hours" (where an hour is 3600 seconds) "P2D" -- parses as "2 days" (where a day is 24 hours or 86400 seconds) "P2DT3H4M" -- parses as "2 days, 3 hours and 4 minutes" "P-6H3M" -- parses as "-6 hours and +3 minutes" "-P6H3M" -- parses as "-6 hours and -3 minutes" "-P-6H+3M" -- parses as "+6 hours and -3 minutes"
key - keydefaultVal - 默认值default java.time.LocalTime getLocalTime(String key, java.time.LocalTime defaultVal)
default java.time.LocalDate getLocalDate(String key, java.time.LocalDate defaultVal)
default java.time.LocalDateTime getLocalDateTime(String key)
default java.time.LocalDateTime getLocalDateTime(String key, java.time.LocalDateTime defaultVal)
key - keydefaultVal - 默认值default java.time.OffsetDateTime getOffsetDateTime(String key, java.time.OffsetDateTime defaultVal)
key - keydefaultVal - 默认值default <T> T getObject(String key, T defaultVal, java.util.function.Function<String,T> func)
Copyright © 2022. All rights reserved.