Modifier and Type | Field and Description |
---|---|
static String |
PROVIDED_ZONE_ID
A string representing the provided zone id.
|
static String |
SYSTEM_ZONE_ID
A string representing the system zone id.
|
Modifier and Type | Method and Description |
---|---|
static <A extends Annotation> |
nonProvidedZoneId(Function<A,String> zoneIdExtractor)
Wraps a zone id extraction function so it will throw an
IllegalStateException if the extracted zone id (as a text value) equals
PROVIDED_ZONE_ID . |
static <A extends Annotation> |
systemOnlyZoneId(Function<A,String> zoneIdExtractor)
Wraps a zone id extraction function so it will throw an
IllegalStateException if the extracted zone id (as a text value) does not equal
SYSTEM_ZONE_ID . |
static ZoneId |
toZoneId(String text)
Returns a
ZoneId for a specific text value. |
public static final String SYSTEM_ZONE_ID
ZoneId.systemDefault()
,
Constant Field Valuespublic static final String PROVIDED_ZONE_ID
public static ZoneId toZoneId(String text)
ZoneId
for a specific text value.text
- The text value for which to return a ZoneId
.ZoneId.systemDefault()
if the given text equals SYSTEM_ZONE_ID
,
null
if the given text equals PROVIDED_ZONE_ID
,
or the result of calling ZoneId.of(String)
otherwise.NullPointerException
- If the given text value is null
.public static <A extends Annotation> Function<A,String> systemOnlyZoneId(Function<A,String> zoneIdExtractor)
IllegalStateException
if the extracted zone id (as a text value) does not equal
SYSTEM_ZONE_ID
. This can be used for validators of types that don't support zone information like LocalDate
.A
- The constraint annotation type from which to extract the zone id.zoneIdExtractor
- A function that extracts the zone id from a constraint annotation.IllegalStateException
if the extracted zone id
does not equal SYSTEM_ZONE_ID
.NullPointerException
- If the given function is null
.public static <A extends Annotation> Function<A,String> nonProvidedZoneId(Function<A,String> zoneIdExtractor)
IllegalStateException
if the extracted zone id (as a text value) equals
PROVIDED_ZONE_ID
. This can be used for validators of types that don't contain any zone information like Date
or
Instant
.A
- The constraint annotation type from which to extract the zone id.zoneIdExtractor
- A function that extracts the zone id from a constraint annotation.IllegalStateException
if the extracted zone id
equals PROVIDED_ZONE_ID
.NullPointerException
- If the given function is null
.Copyright © 2021–2022. All rights reserved.