Package com.ssgllc.fish.f.plaintime
Class PlainTimeBuilder
java.lang.Object
com.ssgllc.fish.f.plaintime.PlainTimeBuilder
Builds a time of day to start an
f().time chain.
Reached as a field: f().time. A time here carries no date and no zone.
The overloads mirror the front end's f().time, so an expression reads the same on
both sides: a string ("14:30" or "2:30pm"), hour and minute with an optional
meridiem, or a map of hour / minute / amPm. amPm is
"am", "pm" or "mil" and defaults to "mil", meaning the hour is
already 24-hour.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionnow()The current time of day, to the minute.of(int hour, int minute) A time of day from a 24-hour hour and a minute.A time of day from an hour, a minute and a meridiem.A time of day parsed from a string.A time of day from a 24-hour hour and a minute, both as strings - the overload for values arriving from form fields or an import row.A time of day from an hour, a minute and a meridiem, all as strings - the front end's primary numeric form, sof().time.of("2", "30", "pm")reads the same on both sides.A time of day from aLocalTime.A time of day from a map ofhourandminute, each an integer or a numeric string.
-
Constructor Details
-
PlainTimeBuilder
public PlainTimeBuilder()
-
-
Method Details
-
of
A time of day parsed from a string. Accepts 24-hour ("14:30","14:30:00") and 12-hour with a meridiem suffix ("2:30pm"), and tolerates a single-digit hour.- Parameters:
time- the value to parse- Returns:
- a time to continue the chain from
Groovy example:
f().time.of("2:30pm").toIso()
Returns:
"14:30"
SpEL example:
#f().time.of("2:30pm").toIso()
-
of
A time of day from aLocalTime.- Parameters:
time- the value to wrap- Returns:
- a time to continue the chain from
-
of
A time of day from a map ofhourandminute, each an integer or a numeric string.An
amPmof"pm"shifts an hour below 12 into the afternoon, matching the front end. Omit it, or pass"am"or"mil", to readhouras a 24-hour value.- Parameters:
obj- map carryinghourandminute, and optionallyamPm- Returns:
- a time to continue the chain from
Groovy example:
f().time.of(['hour': 14, 'minute': 30]).toIso()
Returns:
"14:30"
-
of
A time of day from a 24-hour hour and a minute, both as strings - the overload for values arriving from form fields or an import row. Matches the front end'sof(hour, minute), so the same expression reads the same on both sides.- Parameters:
hour- the hour, 0-23minute- the minute, 0-59- Returns:
- a time to continue the chain from
- Throws:
DateTimeException- if the values are not a valid time
Groovy example:
f().time.of("14", "30").toIso()
Returns:
"14:30"
SpEL example:
#f().time.of("14", "30").toIso()
-
of
A time of day from an hour, a minute and a meridiem, all as strings - the front end's primary numeric form, sof().time.of("2", "30", "pm")reads the same on both sides.- Parameters:
hour- the hour; 1-12 with"am"/"pm", or 0-23 with"mil"minute- the minute, 0-59amPm-"am","pm"or"mil"- Returns:
- a time to continue the chain from
- Throws:
IllegalArgumentException- if the hour, minute or meridiem is out of range
Groovy example:
f().time.of("2", "30", "pm").toIso()
Returns:
"14:30"
SpEL example:
#f().time.of("2", "30", "pm").toIso()
-
of
A time of day from a 24-hour hour and a minute.- Parameters:
hour- the hour, 0-23minute- the minute, 0-59- Returns:
- a time to continue the chain from
Groovy example:
f().time.of(14, 30).toIso()
Returns:
"14:30"
SpEL example:
#f().time.of(14, 30).toIso()
-
of
A time of day from an hour, a minute and a meridiem.- Parameters:
hour- the hour; 1-12 with"am"/"pm", or 0-23 with"mil"minute- the minute, 0-59amPm-"am","pm"or"mil"- Returns:
- a time to continue the chain from
- Throws:
IllegalArgumentException- if the hour, minute or meridiem is out of range
Groovy example:
f().time.of(2, 30, "pm").toIso()
Returns:
"14:30"
SpEL example:
#f().time.of(2, 30, "pm").toIso()
-
now
The current time of day, to the minute. Seconds are dropped, matching the front end'snow()- a plain time carries no finer precision there.- Returns:
- the current hour and minute, as a time to continue the chain from
Groovy example:
f().time.now().toIso()
Returns:
"17:24"
SpEL example:
#f().time.now().toIso()
-