public class TimeWindow extends Object
Modifier and Type | Field and Description |
---|---|
private List<DayOfWeek> |
days |
private List<Integer> |
hours |
private ZoneId |
zone |
Modifier | Constructor and Description |
---|---|
private |
TimeWindow(List<DayOfWeek> days,
List<Integer> hours,
ZoneId zone) |
Modifier and Type | Method and Description |
---|---|
private static DayOfWeek |
dayFrom(String day)
Parse day of week from string
|
List<DayOfWeek> |
days()
Returns days in this time window
|
static TimeWindow |
from(String daySpec,
String hourSpec,
String zoneSpec)
Parse a time window from the given day, hour and time zone specification
|
private static int |
hourFrom(String hour)
Parse hour from string
|
List<Integer> |
hours()
Returns hours in this time window
|
boolean |
includes(Instant instant)
Returns whether the given instant is in this time window
|
private static <T> List<T> |
parse(String spec,
BiFunction<String,String,List<T>> valueParser)
Parse a specification, e.g.
|
private static List<DayOfWeek> |
parseDays(String startInclusive,
String endInclusive)
Returns a list of all days occurring between startInclusive and endInclusive
|
private static List<Integer> |
parseHours(String startInclusive,
String endInclusive)
Returns a list of all hours occurring between startInclusive and endInclusive
|
String |
toString() |
ZoneId |
zone()
Returns the time zone of this time window
|
private static ZoneId |
zoneFrom(String zone)
Parse time zone from string
|
private final ZoneId zone
public ZoneId zone()
public boolean includes(Instant instant)
public static TimeWindow from(String daySpec, String hourSpec, String zoneSpec)
private static <T> List<T> parse(String spec, BiFunction<String,String,List<T>> valueParser)
private static List<Integer> parseHours(String startInclusive, String endInclusive)
private static List<DayOfWeek> parseDays(String startInclusive, String endInclusive)
private static int hourFrom(String hour)
Copyright © 2017. All rights reserved.