@CalendarType(value="iso8601") public final class SpanOfWeekdays extends ChronoEntity<SpanOfWeekdays> implements Iterable<Weekday>, Serializable
Describes an arbitrary span of weekdays.
Following elements which are declared as constants are registered by this class:
| Modifier and Type | Field and Description |
|---|---|
static ChronoElement<Weekday> |
END
Denotes the end of this span of weekdays (inclusive).
|
static ChronoElement<Weekday> |
START
Denotes the start of this span of weekdays.
|
| Modifier and Type | Method and Description |
|---|---|
static SpanOfWeekdays |
between(Weekday start,
Weekday end)
Creates a new span of weekdays.
|
static SpanOfWeekdays |
betweenMondayAndFriday()
Creates a typical working week from Monday to Friday.
|
static Chronology<SpanOfWeekdays> |
chronology()
Yields the associated chronology.
|
boolean |
equals(Object obj) |
static ChronoFormatter<SpanOfWeekdays> |
formatter(String dynamicPattern,
Locale locale)
Creates a formatter for given dynamic format pattern and locale.
|
Weekday |
getEnd()
Obtains the end of this span of weekdays.
|
Weekday |
getStart()
Obtains the start of this span of weekdays.
|
int |
hashCode() |
Iterator<Weekday> |
iterator() |
int |
length()
Determines the count of days belonging to this span of weekdays.
|
static SpanOfWeekdays |
on(Weekday day)
Creates a span of weekdays of only one day.
|
String |
toString() |
contains, get, get, getInt, getMaximum, getMinimum, getRegisteredElements, getTimezone, hasTimezone, isValid, isValid, isValid, matches, with, with, with, withforEach, spliterator@FormattableElement(format="S", alt="s", dynamic=true) public static final ChronoElement<Weekday> START
Denotes the start of this span of weekdays.
@FormattableElement(format="E", alt="e", dynamic=true) public static final ChronoElement<Weekday> END
Denotes the end of this span of weekdays (inclusive).
public static SpanOfWeekdays on(Weekday day)
Creates a span of weekdays of only one day.
day - the single day of week which forms the spanpublic static SpanOfWeekdays betweenMondayAndFriday()
Creates a typical working week from Monday to Friday.
public static SpanOfWeekdays between(Weekday start, Weekday end)
Creates a new span of weekdays.
It is possible to choose the same weekday for start and end. Then the resulting span will just consist of one single weekday.
start - the starting weekdayend - the ending weekday (inclusive)public Weekday getStart()
Obtains the start of this span of weekdays.
public Weekday getEnd()
Obtains the end of this span of weekdays.
public int length()
Determines the count of days belonging to this span of weekdays.
1-7public static ChronoFormatter<SpanOfWeekdays> formatter(String dynamicPattern, Locale locale)
Creates a formatter for given dynamic format pattern and locale.
The pattern is of dynamic type and only uses the
symbol letters "S" (=START) and "E" (=END). The start must
be present, but the end is optional. If the end is missing in parsing then it
will be set to the start. The count of symbols controls the text width, and the
output context can be set by an extra format attribute. Example:
ChronoFormatter<SpanOfWeekdays> f =
SpanOfWeekdays.formatter("SSSS[ 'to' EEEE]", Locale.ENGLISH);
assertThat(f.format(SpanOfWeekdays.betweenMondayAndFriday()), is("Monday to Friday"));
assertThat(f.parse("Sunday"), is(SpanOfWeekdays.on(Weekday.SUNDAY)));
dynamicPattern - format patternlocale - the locale informationSTART,
END,
PatternType.DYNAMIC,
Attributes.OUTPUT_CONTEXTpublic static Chronology<SpanOfWeekdays> chronology()
Yields the associated chronology.
Copyright © 2014–2021. All rights reserved.