T
- the type of the temporal unitpublic abstract class Resolution<T extends TemporalUnit> extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Resolution.Position |
Constructor and Description |
---|
Resolution(T temporalUnit,
String format,
int stepRate)
Constructs a new resolution for the given temporal unit, in the
given format, step rate, for all positions.
|
Resolution(T temporalUnit,
String format,
int stepRate,
Resolution.Position... supportedPositions)
Constructs a new resolution for the given temporal unit, in the
given format, step rate, and for the given supported positions.
|
Modifier and Type | Method and Description |
---|---|
abstract VirtualGrid<T> |
createGrid()
Creates a virtual grid for editing operations based on the settings of this
resolution.
|
abstract Instant |
decrement(Instant instant,
ZoneId zoneId)
Decrements the given time based on the temporal unit represented by this
resolution.
|
abstract String |
format(Instant instant,
ZoneId zoneId)
Formats the given time / instant for the given time zone based on the
settings of this resolution.
|
String |
getFormat()
Returns the format in which the resolution will be displayed.
|
int |
getStepRate()
Returns the step rate of this resolution, e.g.
|
T |
getTemporalUnit()
Returns the temporal unit represented by this resolution.
|
abstract Instant |
increment(Instant instant,
ZoneId zoneId)
Increments the given time based on the temporal unit represented by this
resolution.
|
boolean |
isSupportingPosition(Resolution.Position position)
Determines if the given position is supported by this resolution.
|
String |
toString() |
abstract Instant |
truncate(Instant instant,
ZoneId zoneId,
DayOfWeek firstDayOfWeek)
Truncates the given time based on the temporal unit represented by this
resolution.
|
public Resolution(T temporalUnit, String format, int stepRate, Resolution.Position... supportedPositions)
temporalUnit
- the temporal unit (e.g. DAYS)format
- the display format (e.g. HH:MM)stepRate
- the step rate (e.g. 1, 5, 10, 15, 30)supportedPositions
- the supported positions (top, middle, bottom) inside the datelinepublic Resolution(T temporalUnit, String format, int stepRate)
temporalUnit
- the temporal unit (e.g. DAYS)format
- the display format (e.g. HH:MM)stepRate
- the step rate (e.g. 1, 5, 10, 15, 30)public final boolean isSupportingPosition(Resolution.Position position)
position
- the positionpublic final T getTemporalUnit()
public final String getFormat()
DateTimeFormatter.format(TemporalAccessor)
public final int getStepRate()
public abstract String format(Instant instant, ZoneId zoneId)
instant
- the time used for the formattingzoneId
- the time zonepublic abstract Instant truncate(Instant instant, ZoneId zoneId, DayOfWeek firstDayOfWeek)
instant
- the time to truncatezoneId
- the time zonefirstDayOfWeek
- the weekday that is considered to be the first
day of the weekpublic abstract Instant increment(Instant instant, ZoneId zoneId)
instant
- the time to incrementzoneId
- the time zonepublic abstract Instant decrement(Instant instant, ZoneId zoneId)
instant
- the time to incrementzoneId
- the time zonepublic abstract VirtualGrid<T> createGrid()
Copyright © 2020 Dirk Lemmermann Software & Consulting. All rights reserved.